S3-хранилище и вложения, трек 1

This commit is contained in:
Queenfish
2026-10-29 00:03:34 +03:00
parent ec540a1a72
commit 32e105cc87
66 changed files with 5265 additions and 30 deletions
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
import threading
import time
import uuid
from collections import Counter
import httpx
BASE = "http://localhost:8080"
def main():
counter = Counter()
lock = threading.Lock()
def worker():
with httpx.Client(timeout=5) as c:
for _ in range(20):
try:
r = c.get(f"{BASE}/health/live")
if r.status_code == 200:
with lock:
counter[r.headers.get("x-instance-id")] += 1
except Exception:
pass
time.sleep(0.05)
threads = [threading.Thread(target=worker) for _ in range(20)]
for t in threads:
t.start()
for t in threads:
t.join()
print(counter)
if __name__ == "__main__":
main()