mirror of
https://github.com/osmarks/meme-search-engine.git
synced 2025-01-23 15:36:55 +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()
|
event = asyncio.Event()
|
||||||
results = None
|
results = None
|
||||||
def callback(*argv):
|
def callback(*argv):
|
||||||
loop.call_soon_threadsafe(lambda: event.set())
|
|
||||||
nonlocal results
|
nonlocal results
|
||||||
results = argv
|
results = argv
|
||||||
|
loop.call_soon_threadsafe(lambda: event.set())
|
||||||
pq.put_nowait(InferenceParameters(data.get("text"), data.get("images"), callback))
|
pq.put_nowait(InferenceParameters(data.get("text"), data.get("images"), callback))
|
||||||
await event.wait()
|
await event.wait()
|
||||||
body_data = results[1]
|
body_data = results[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user