fix: the worker waits out a short storage outage, and Sentry hears of one that outlasts the attempts once (DTF-API-A)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m2s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m53s

R2 answered 503 while a print file tile of #53 was stored, and botocore's
two tries ran out. The worker's own reads and writes (store, fetch) now
use a client with up to 10 tries in standard mode, about two minutes of
backoff; requests a person waits on keep two. A storage failure that
still happens is a warning while the job has attempts left and an error
on the last one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-19 09:52:25 -03:00
parent 662d6f9c41
commit 177694edd3
2 changed files with 19 additions and 5 deletions

View File

@@ -255,9 +255,17 @@ def render_one(storage):
stored.append((uid, name, os.path.getsize(path), key))
store_tiles(storage, os.path.join(scratch, 'tiles', name), uid)
except Exception as exc:
# Storage failing is an attempt like any other, not a claim held for an hour.
logging.exception('Storing the print file failed')
finish(job, 'failed' if job['attempts'] + 1 >= MAX_ATTEMPTS else 'pending', {'error': type(exc).__name__})
# Storage failing is an attempt like any other, not a claim held for an
# hour. The storage client already waited out a short outage; Sentry
# hears of one that outlasts every attempt, once, not of each retry
# (Sentry DTF-API-A).
final = job['attempts'] + 1 >= MAX_ATTEMPTS
if final:
logging.exception('Storing the print file failed: order #%s item %s', job['number'], job['item_index'] + 1)
else:
logging.warning('Storing the print file failed, retrying: order #%s item %s: %s',
job['number'], job['item_index'] + 1, exc)
finish(job, 'failed' if final else 'pending', {'error': type(exc).__name__})
return True
finally:
shutil.rmtree(scratch, ignore_errors=True)