ЛР 6 - БПИ2302 - Самохвалов - на 5 #2

Open
SamohvalovAndreyBPI2302 wants to merge 13 commits from SamohvalovAndreyBPI2302/mtusi2026lab6:solution/bpi2302-samohvalov into main
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 9fac497d1a - Show all commits
+7 -1
View File
@@ -2,6 +2,7 @@
import json
import os
import time
from pathlib import Path
from uuid import UUID, uuid4
@@ -52,7 +53,12 @@ try:
"SELECT published_at IS NOT NULL AS confirmed FROM attachment_outbox "
"WHERE id=%s", (row["id"],),
).fetchone()
count = channel.queue_declare(queue=QUEUE, passive=True).method.message_count
deadline = time.monotonic() + 3
while True:
count = channel.queue_declare(queue=QUEUE, passive=True).method.message_count
if count >= 2 or time.monotonic() >= deadline:
break
time.sleep(0.05)
assert published >= 1 and outbox["confirmed"] and count >= 2
print(json.dumps({"confirmed_after_republish": True, "queued_copies_before_worker": count}))
finally:
+1 -1
View File
@@ -13,7 +13,7 @@ from client import Client, arguments, check, run # noqa: E402
def compose(*args, input_data=None):
return subprocess.run(
["docker", "compose", *args], cwd=ROOT,
["docker", "compose", "-f", "compose.yaml", "-f", "compose.telemetry.yaml", *args], cwd=ROOT,
input=input_data, check=True,
)