Skip to content

Commit

Permalink
Fix logic and log if cache is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed Aug 23, 2024
1 parent ef08c96 commit 52326b3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions indra_network_search/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,18 @@ def query(search_query: NetworkSearchQuery, background_tasks: BackgroundTasks):
background_tasks.add_task(dump_query_json_to_s3, query_hash, search_query.dict())

else:
logger.info("Performing new search")
if not CACHE_RESULTS:
logger.info("Cache is disabled, performing new search")
else:
logger.info("Performing new search")
results = network_search_api.handle_query(rest_query=search_query)
logger.info("Uploading results to S3")
background_tasks.add_task(dump_result_json_to_s3, query_hash, results.dict())
background_tasks.add_task(dump_query_json_to_s3, query_hash, search_query.dict())

if CACHE_RESULTS:
logger.info("Uploading results to S3")
background_tasks.add_task(dump_result_json_to_s3, query_hash, results.dict())
background_tasks.add_task(dump_query_json_to_s3, query_hash, search_query.dict())
else:
logger.info("Cache is disabled, skipping S3 upload")

return results

Expand Down

0 comments on commit 52326b3

Please sign in to comment.