network error
This commit is contained in:
11
server.py
11
server.py
@@ -223,13 +223,14 @@ def update_task_status(task: dict, status: str, progress: int, data: list = []):
|
|||||||
requests.put(f"http://localhost:3000/api/drawing/{task['id']}", json=task)
|
requests.put(f"http://localhost:3000/api/drawing/{task['id']}", json=task)
|
||||||
|
|
||||||
# 从局域网中获取一组任务(如果列表为空,等待2s后重新获取)
|
# 从局域网中获取一组任务(如果列表为空,等待2s后重新获取)
|
||||||
def get_tasks():
|
def get_tasks(tasks:list=[]):
|
||||||
tasks = requests.get("http://localhost:3000/api/drawing?status=waiting").json()
|
|
||||||
if len(tasks) == 0:
|
|
||||||
while len(tasks) == 0:
|
while len(tasks) == 0:
|
||||||
print('no task, wait 2s...')
|
try:
|
||||||
time.sleep(2)
|
|
||||||
tasks = requests.get("http://localhost:3000/api/drawing?status=waiting").json()
|
tasks = requests.get("http://localhost:3000/api/drawing?status=waiting").json()
|
||||||
|
if len(tasks) == 0: time.sleep(2)
|
||||||
|
except:
|
||||||
|
print("get tasks error")
|
||||||
|
time.sleep(2)
|
||||||
return tasks
|
return tasks
|
||||||
|
|
||||||
def main_dev(opt):
|
def main_dev(opt):
|
||||||
|
Reference in New Issue
Block a user