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:
parent
120edc1a47
commit
8abe384cd1
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user