Измеряйте загрузку до подтверждения приёма вложения

This commit is contained in:
2026-11-20 10:54:35 +03:00
parent c27b681689
commit b05b33824f
3 changed files with 39 additions and 12 deletions
+1 -4
View File
@@ -140,10 +140,7 @@ def experiment(args, content, report):
report['download'] = {'ok': False}
if accepted:
try:
response = bootstrap.call('GET', '/api/v1/attachments/' + accepted[0]['attachment_id'] + '/content', actor=reader)
body = response['bytes']
report['download'] = {'ok': body == content and response['headers'].get_content_type() == args.mime,
'status': response['status'], 'bytes': len(body), 'sha256': hashlib.sha256(body).hexdigest()}
report['download'] = memory.verify_download(bootstrap, reader, accepted[0]['attachment_id'], content, args.mime)
except Exception as exc:
report['download']['error'] = str(exc) if isinstance(exc, module.Failure) else type(exc).__name__
report['ok'] = (len(accepted) == args.concurrency and report['download']['ok'] and stable