Skip to content

Commit

Permalink
perform db query on /organization 1% of the time
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmanvar committed Nov 28, 2023
1 parent 580f901 commit 77f0bb3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion flask/src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import operator
import os
import random
import requests
import time
from flask import Flask, json, request, make_response, send_from_directory
Expand Down Expand Up @@ -117,7 +118,7 @@ def products():
try:
with sentry_sdk.start_span(op="/products.get_products", description="function"):
rows = get_products()

if RUN_SLOW_PROFILE:
start_time = time.time()
productsJSON = json.loads(rows)
Expand Down Expand Up @@ -187,6 +188,10 @@ def api():

@app.route('/organization', methods=['GET'])
def organization():
# perform get_products db query 1% of time in order
# to populate "Found In" endpoints in Queries
if random.random() < 0.01:
rows = get_products()
return "flask /organization"

@app.route('/connect', methods=['GET'])
Expand Down

0 comments on commit 77f0bb3

Please sign in to comment.