ЛР 3: масштабирование и отказоустойчивость API

This commit is contained in:
EgorAnti
2026-11-03 20:53:02 +03:00
parent 0ab3a341aa
commit 8105f90097
115 changed files with 5018 additions and 38 deletions
+2 -1
View File
@@ -100,7 +100,8 @@ def main():
check(first_recovery is not None and first_recovery<=10,'writes did not recover within 10 seconds from hook start')
check(len(after_instances)>=5,'too few successful writes after stop')
check(target not in after_instances[-5:],'target replica still serves requests; hook must leave it stopped')
print(json.dumps({'observed_instances_before':len(observed),'successful_writes':len(successes),'failed_attempts':failures,'first_recovery_seconds':round(first_recovery,3)},ensure_ascii=False))
duration = time.monotonic()-started
print(json.dumps({'observed_instances_before':len(observed),'successful_writes':len(successes),'failed_attempts':failures,'successful_rps':round(len(successes)/duration,3),'first_recovery_seconds':round(first_recovery,3)},ensure_ascii=False))
# Existing token, no re-login. Read all confirmations and reject duplicates.
messages = history(c,bob,chat)
ids = [m['id'] for m in messages]