Skip to content

Commit

Permalink
Merge pull request #139 from ranking-agent/persistent_num_responses
Browse files Browse the repository at this point in the history
Make num_responses persistent through rbtmq connection resets
  • Loading branch information
maximusunc authored Nov 10, 2022
2 parents de4d049 + cfd791f commit 8ed4581
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openapi-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ servers:
# url: http://127.0.0.1:5000
termsOfService: http://robokop.renci.org:7055/tos?service_long=ARAGORN&provider_long=RENCI
title: ARAGORN
version: 2.1.7
version: 2.1.8
tags:
- name: translator
- name: ARA
Expand Down
6 changes: 2 additions & 4 deletions src/service_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ async def assemble_callbacks(guid, num_queries):
start = dt.now()

while not done:
num_new_responses, done = await check_for_messages(guid, pydantic_kgraph, accumulated_results, num_queries)
num_responses += num_new_responses
num_responses, done = await check_for_messages(guid, pydantic_kgraph, accumulated_results, num_queries, num_responses)
time_spent = dt.now() - start
if time_spent > OVERALL_TIMEOUT:
logger.info(f"{guid}: Timing out receiving callbacks")
Expand Down Expand Up @@ -291,9 +290,8 @@ async def delete_queue(guid):
queue = await channel.queue_delete(guid)


async def check_for_messages(guid, pydantic_kgraph, accumulated_results, num_queries):
async def check_for_messages(guid, pydantic_kgraph, accumulated_results, num_queries, num_responses):
complete = False
num_responses = 0
# We want to reset the connection to rabbit every once in a while
# The timeout is how long to wait for a next message after processing. So when there are many messages
# coming in, the connection will stay open for longer than this time
Expand Down

0 comments on commit 8ed4581

Please sign in to comment.