Implement lab4 S3 attachments and reliability checks

This commit is contained in:
Polusikkkk
2026-11-05 18:42:22 +03:00
parent ec540a1a72
commit 0f6615dbb9
51 changed files with 6018 additions and 23 deletions
+34
View File
@@ -0,0 +1,34 @@
from __future__ import annotations
import asyncio
import time
from app.errors import ApiError
from app.storage import check_storage
async def main() -> None:
deadline = time.monotonic() + 90
while True:
try:
await check_storage()
except ApiError:
if time.monotonic() >= deadline:
raise SystemExit(
"S3 readiness failed: bucket unavailable "
"or API credentials rejected"
) from None
print("Waiting for S3 bucket...", flush=True)
await asyncio.sleep(2)
else:
print(
"S3 bucket is accessible with API credentials",
flush=True,
)
return
if __name__ == "__main__":
asyncio.run(main())