feat(work): persist queued tasks before device acceptance

This commit is contained in:
ex_tianzy
2026-11-23 15:49:50 +08:00
parent 1e7307e45d
commit 93739a6089
10 changed files with 294 additions and 19 deletions
+2 -1
View File
@@ -52,7 +52,7 @@ async def routed(env, tmp_path):
await asyncio.wait_for(server_task,5)
async def device(env, host="a"*32, *, generation=None, legacy=False, work_files=False):
async def device(env, host="a"*32, *, generation=None, legacy=False, work_files=False,durable_dispatch=False):
ws = await connect(env["url"],proxy=None)
env["sessions"].append(ws)
challenge = json.loads(await ws.recv())["challenge"]
@@ -66,6 +66,7 @@ async def device(env, host="a"*32, *, generation=None, legacy=False, work_files=
app_id=env["settings"].feishu_app_id,binding_owner=row["owner"] or "ou_a",
binding_generation=row["binding_generation"] if generation is None else generation)
if work_files:plain['work_files']='work-files-v1'
if durable_dispatch:plain['durable_dispatch']='work-dispatch-v1'
await ws.send(json.dumps({"host_id":host,"cert":row["cert"],"proof":sign(plain,env["keys"][host])}))
accepted = json.loads(await asyncio.wait_for(ws.recv(),3))
assert accepted["type"] == "connected"