fix: large carts upload all their files (Marcus's bugs of 11/11, B1 to B4)

B1: an upload start was limited to 60 per 15 minutes per session, so a
66-file cart failed with 'Muitas tentativas'; now 1000 per session and
3000 per source, and the Site waits Retry-After and retries quietly.
B2: a failed file shows its error and 'Tentar de novo' on its own card, and
payment stays blocked with 'Falta enviar N arquivos'. B3: after signing in
again, an upload id the new session does not own (403) is dropped and the
file starts again. B4: the quote is never created before every file is
sent, and an untranslatable 422 is logged for Sentry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-11 14:49:04 -03:00
parent 07515abbd8
commit 7a24c66997
7 changed files with 180 additions and 12 deletions

View File

@@ -114,13 +114,18 @@ function pintaPedido(){
'<div class="l"><span>Revisão e reencaixe</span>'+
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>';
$('carrTot').textContent=rs(soma);
$('bPagarTx').textContent = n>1
? 'Pagar os '+n+' itens de uma vez'
: 'Ir para o pagamento';
// A file still on its way (or failed) keeps the payment closed (B2).
const faltaEnvio=window.dtfFaltaEnvio?window.dtfFaltaEnvio():null;
const falta=faltaEnvio?.falta||0;
$('bPagarTx').textContent = falta
? 'Falta enviar '+falta+(falta===1?' arquivo':' arquivos')
: n>1
? 'Pagar os '+n+' itens de uma vez'
: 'Ir para o pagamento';
// The proof is only for orders above 10 m (Dropstar, 2026-10-28): below it the box is gone.
const prova=$('fProva');
if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10; prova.closest('.cxE').hidden=!longo; if(!longo) prova.checked=false; }
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk();
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk() || falta>0;
if(pedido.length || itemAtual) $('carr').classList.add('on');
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;
$('cartLink').setAttribute('aria-label','Carrinho, '+noCarrinho+(noCarrinho===1?' item':' itens')); }