fix: the Kanban says the proof machine before a pull, folder downloads cut by the network wait for the next pass, expected refusals stay out of Sentry (DTF-WEB-16..1K, DTF-API-C)
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 7m37s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m25s
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 7m37s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m25s
- 19/1F: the board carries the approved proof's machine; the pull and the order's machine field keep to it and say why. - 17/1E: a network drop while a download or an answer arrives counts as unreachable/offline, warned first like the others. - 16: no folder picker (Safari): said in a line. - 1A, 1J/1K, 1D, 18: guidance and expected refusals (pull to another machine, someone already on the machine, e-mail in use, coupon) are not errors. - 1B: an empty file is refused on the page. - API-C: the Tiny's rate limit reaches Sentry only if it repeats. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,7 @@ def with_print_files(c, orders):
|
||||
hot = hotfolder.progress(c, [o['id'] for o in orders if o['state'] == 'imp'])
|
||||
# Each parent's latest proof card, and each card's parent (app/proof.py).
|
||||
children = {r['parent_id']: r for r in c.execute('''SELECT DISTINCT ON (parent_id) parent_id,id,number,state,
|
||||
proof_result,proof_decided_at,proof_decided_by,proof_reason FROM dtf_local.orders
|
||||
proof_result,proof_decided_at,proof_decided_by,proof_reason,machine_id FROM dtf_local.orders
|
||||
WHERE parent_id=ANY(%s) AND cancelled_at IS NULL ORDER BY parent_id, created_at DESC''', (ids,)).fetchall()}
|
||||
parents = {r['id']: r for r in c.execute('SELECT id,number,state FROM dtf_local.orders WHERE id=ANY(%s)',
|
||||
([o['parent_id'] for o in orders if o.get('parent_id')],)).fetchall()}
|
||||
@@ -225,8 +225,10 @@ def with_print_files(c, orders):
|
||||
order['hot'] = hot.get(order['id'])
|
||||
order['reviews'] = review_rows.get(str(order['id']), [])
|
||||
child = children.get(order['id'])
|
||||
# Its machine: an order prints where its approved proof did (Dropstar, 2026-11-05).
|
||||
order['proof_card'] = child and {**{k: child[k] for k in ('id', 'number', 'state', 'proof_result',
|
||||
'proof_decided_at', 'proof_decided_by', 'proof_reason')},
|
||||
'proof_decided_at', 'proof_decided_by', 'proof_reason',
|
||||
'machine_id')},
|
||||
'reviews': proof_reviews.get(str(child['id']), [])}
|
||||
parent = parents.get(order.get('parent_id'))
|
||||
order['proof_parent'] = parent and {'id': parent['id'], 'number': parent['number'], 'state': parent['state']}
|
||||
|
||||
@@ -188,6 +188,12 @@ class TinyError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class TinyRateLimit(TinyError):
|
||||
"""Too many calls for the moment: the outbox's next try goes through
|
||||
(Sentry DTF-API-C). `transient`: the worker reports it only if it repeats."""
|
||||
transient = True
|
||||
|
||||
|
||||
class TinyNotConnected(TinyError):
|
||||
"""No authorised connection yet: an operator must click "Conectar Tiny"."""
|
||||
|
||||
@@ -812,7 +818,7 @@ class TinyOrders:
|
||||
headers = {'Authorization': f'Bearer {self.auth.access_token()}'}
|
||||
response = self.http.request(method, path, headers=headers, **kwargs)
|
||||
if response.status_code == 429:
|
||||
raise TinyError('Tiny rate limit reached; the outbox will retry')
|
||||
raise TinyRateLimit('Tiny rate limit reached; the outbox will retry')
|
||||
if response.status_code >= 400:
|
||||
raise TinyError(f'{method} {path}: {response.status_code} {response.text[:300]}')
|
||||
return response.json() if response.content else {}
|
||||
|
||||
@@ -81,9 +81,10 @@ def tick():
|
||||
# Sentry hears of a refused delivery on its first failure and
|
||||
# every tenth after, not only Integrações (the Tiny refused
|
||||
# #42 fourteen times unseen, 2026-11-18). One message
|
||||
# template, so Sentry keeps it as one issue per kind.
|
||||
# template, so Sentry keeps it as one issue per kind. A
|
||||
# passing refusal (the Tiny's rate limit) only from the tenth.
|
||||
attempt = job['attempts'] + 1
|
||||
if attempt == 1 or attempt % 10 == 0:
|
||||
if attempt == 1 and not getattr(exc, 'transient', False) or attempt % 10 == 0:
|
||||
logging.error('Outbox delivery to %s failed (%s, attempt %s): %s',
|
||||
job['provider'], job['event_key'], attempt, str(exc)[:500])
|
||||
last_tick = time.monotonic()
|
||||
|
||||
Reference in New Issue
Block a user