1
0
mirror of https://github.com/osmarks/meme-search-engine.git synced 2024-11-10 22:09:54 +00:00

fix concurrency bug

This commit is contained in:
osmarks 2023-09-29 18:35:42 +01:00
parent 120edc1a47
commit 8abe384cd1

View File

@ -88,9 +88,9 @@ async def run_inference(request):
event = asyncio.Event()
results = None
def callback(*argv):
loop.call_soon_threadsafe(lambda: event.set())
nonlocal results
results = argv
loop.call_soon_threadsafe(lambda: event.set())
pq.put_nowait(InferenceParameters(data.get("text"), data.get("images"), callback))
await event.wait()
body_data = results[1]