probably fixed #5, need more testing
This commit is contained in:
@@ -2,7 +2,7 @@ import asyncio
|
|||||||
import base64
|
import base64
|
||||||
import pickle as pkl
|
import pickle as pkl
|
||||||
import uuid
|
import uuid
|
||||||
from threading import Thread
|
from threading import Lock, Thread
|
||||||
|
|
||||||
import fastapi
|
import fastapi
|
||||||
from uvicorn import Config, Server
|
from uvicorn import Config, Server
|
||||||
@@ -31,6 +31,8 @@ class _Router:
|
|||||||
"""
|
"""
|
||||||
Method which queries an available task and sends the data to the attached runner.
|
Method which queries an available task and sends the data to the attached runner.
|
||||||
"""
|
"""
|
||||||
|
l = Lock()
|
||||||
|
l.acquire()
|
||||||
await wsConnection.accept()
|
await wsConnection.accept()
|
||||||
await wsConnection.send_text(str(self.runnerCount))
|
await wsConnection.send_text(str(self.runnerCount))
|
||||||
methods = await wsConnection.receive()
|
methods = await wsConnection.receive()
|
||||||
@@ -41,6 +43,7 @@ class _Router:
|
|||||||
runnerID = self.runnerCount
|
runnerID = self.runnerCount
|
||||||
self.runnerCount += 1
|
self.runnerCount += 1
|
||||||
runnerCounter = 0
|
runnerCounter = 0
|
||||||
|
l.release()
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
# add this id back into available id pools using a shared list.
|
# add this id back into available id pools using a shared list.
|
||||||
|
|||||||
Reference in New Issue
Block a user