Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perform db query on /organization 1% of the time #351

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading