-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When Request /worker_generate API and semaphore value bigger than 0, The program is blocked by worker.generate_gate(params)
and not await acquire_worker_semaphore()
. because worker.generate_gate(params)
is runnning in main thread. other request will wait.
/worker_generate_stream
doesn't blocked, maybe StreamResponse will start new subthread.
example:
first request: POST /worker_generate , Try to resp for as long as possible
second request: POST /worker_get_status, When the first request is not completed, the second request will be blocked.
solution:
I don't know much about python. Is it elegant in this way? Place generate_gate
in non main thread
output = await asyncio.to_thread(worker.generate_gate, params)
thanks.
relate issue: #2285
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working