fix: 96 DPI is accepted as the Site shows it; big carts upload 4 at a time (Sentry 12/11)
The server compared the raw lowest resolution (95,6) with 96 but printed it rounded, refusing '96 DPI abaixo do mínimo de 96'; it now decides on the same rounded value the Site shows. A big cart started every upload at once and hit the limit of 10 pending uploads (429): the limit is 30, that refusal carries Retry-After so the Site retries by itself, and the Site runs at most 4 uploads at a time. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,10 +47,16 @@ def begin_upload(body: UploadStart, session_id=Depends(owner), _source=Depends(u
|
||||
count(*) FILTER(WHERE owner=%s AND NOT complete) AS pending
|
||||
FROM dtf_local.uploads WHERE purged_at IS NULL''',
|
||||
(session_id,session_id)).fetchone()
|
||||
if (usage['total']+body.size > int(os.environ.get('STORAGE_QUOTA_BYTES','53687091200')) or
|
||||
usage['owned']+body.size > int(os.environ.get('OWNER_UPLOAD_QUOTA_BYTES','10737418240')) or
|
||||
usage['pending'] >= int(os.environ.get('MAX_PENDING_UPLOADS','10'))):
|
||||
storage_full = (usage['total']+body.size > int(os.environ.get('STORAGE_QUOTA_BYTES','53687091200')) or
|
||||
usage['owned']+body.size > int(os.environ.get('OWNER_UPLOAD_QUOTA_BYTES','10737418240')))
|
||||
pending_full = usage['pending'] >= int(os.environ.get('MAX_PENDING_UPLOADS','30'))
|
||||
if storage_full or pending_full:
|
||||
audit('upload_quota_rejected')
|
||||
if pending_full and not storage_full:
|
||||
# A big cart goes 4 at a time now (web/upload.js); a burst may
|
||||
# still meet the pending cap: ask the Site to wait and retry.
|
||||
raise HTTPException(429, 'Muitos envios ao mesmo tempo. O site tenta de novo sozinho.',
|
||||
headers={'Retry-After': '15'})
|
||||
raise HTTPException(429, 'Limite de armazenamento ou de envios pendentes atingido. Tente de novo mais tarde.')
|
||||
multipart = storage.begin(key)
|
||||
c.execute('''INSERT INTO dtf_local.uploads(id,owner,name,original_name,size,object_key,multipart_id,expires_at)
|
||||
|
||||
Reference in New Issue
Block a user