forked from mtusi2026/mtusi2026lab5
feat: крролик, по тщ 5 лаба
This commit is contained in:
@@ -174,7 +174,7 @@ def upload_once(base: str, token: str, chat_id: str, content: bytes, content_typ
|
||||
except OSError as error:
|
||||
return {"status": None, "error": type(error).__name__, "seconds": time.monotonic() - started}
|
||||
result = {"status": status, "instance": instance, "seconds": time.monotonic() - started}
|
||||
if status == 201:
|
||||
if status == 202:
|
||||
result["id"] = json.loads(body)["id"]
|
||||
return result
|
||||
|
||||
@@ -218,10 +218,11 @@ def run_round(client: Client, actor: dict, chat: dict, profile: str, content: by
|
||||
sampler.stop()
|
||||
after = {container_name(c): process_status(c) for c in containers}
|
||||
|
||||
ok = [r for r in results if r.get("status") == 201]
|
||||
ok = [r for r in results if r.get("status") == 202]
|
||||
sample = ok[0]["id"] if ok else None
|
||||
checksum_ok = None
|
||||
if sample:
|
||||
client.wait_ready(actor, {"id": sample})
|
||||
downloaded = client.call("GET", f"/api/v1/attachments/{sample}/content", actor=actor)["bytes"]
|
||||
checksum_ok = hashlib.sha256(downloaded).digest() == hashlib.sha256(content).digest()
|
||||
seconds = [r["seconds"] for r in ok]
|
||||
|
||||
Reference in New Issue
Block a user