fix: a pull on a card changed elsewhere tries once more, and a file held by the FlexiPRINT is a warning (DTF-WEB-K, DTF-WEB-M)
Some checks failed
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Failing after 2m51s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Has been skipped
Some checks failed
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Failing after 2m51s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Has been skipped
Pull: on "O pedido mudou" the board reloads; a card still in Arte conferida is pulled again with the fresh version, one already printing on that machine is left as it is, anything else reports the conflict. Folders: a file another program holds open is expected while the FlexiPRINT reads it. The first pass warns without the error flag, so it no longer reaches Sentry; only a file still held after 10 passes (about 5 minutes) is an error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -636,12 +636,28 @@ async function pullTo(order, machineId){
|
|||||||
const alert=(machine?.alerts||[]).find(row=>row.blocking);
|
const alert=(machine?.alerts||[]).find(row=>row.blocking);
|
||||||
if(alert&&!await machineAlertDialog(order,target,alert))return;
|
if(alert&&!await machineAlertDialog(order,target,alert))return;
|
||||||
try{
|
try{
|
||||||
await move(order,'imp','',target);
|
await pullMove(order,target);
|
||||||
}catch(e){
|
}catch(e){
|
||||||
if(e.status===409&&String(e.message).startsWith('Antes do próximo arquivo')){say(e.message,true);return;}
|
if(e.status===409&&String(e.message).startsWith('Antes do próximo arquivo')){say(e.message,true);return;}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The card changed elsewhere between the board's load and the pull (another
|
||||||
|
// tab or person; the machine alert in between gives it time): reload and, if
|
||||||
|
// it still waits in Arte conferida, pull once more with the fresh version;
|
||||||
|
// the server checks everything again (Sentry DTF-WEB-K, as DTF-WEB-7).
|
||||||
|
async function pullMove(order,target){
|
||||||
|
try{
|
||||||
|
await move(order,'imp','',target);
|
||||||
|
}catch(error){
|
||||||
|
if(error.status!==409||!String(error.message).startsWith('O pedido mudou'))throw error;
|
||||||
|
await load();
|
||||||
|
const fresh=(board.orders||[]).find(row=>row.id===order.id);
|
||||||
|
if(fresh?.state==='imp'&&fresh.machine?.id===target){say('O pedido já estava imprimindo nesta máquina.');return;}
|
||||||
|
if(!fresh||fresh.cancelled_at||fresh.state!=='tra')throw error;
|
||||||
|
await move(fresh,'imp','',target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Minha conta: who is signed in, and the password, which only the person changes.
|
// Minha conta: who is signed in, and the password, which only the person changes.
|
||||||
function accountForm(){
|
function accountForm(){
|
||||||
|
|||||||
@@ -282,7 +282,10 @@ const RECEIPTS_FOLDER='Recibos';
|
|||||||
const REVIEWS_FOLDER='Revisões';
|
const REVIEWS_FOLDER='Revisões';
|
||||||
const FOLDER={mode:'showDirectoryPicker' in window?'folder':/Firefox\//.test(navigator.userAgent)?'downloads':'none',
|
const FOLDER={mode:'showDirectoryPicker' in window?'folder':/Firefox\//.test(navigator.userAgent)?'downloads':'none',
|
||||||
brave:!!navigator.brave,handle:null,granted:false,downloads:false,since:null,
|
brave:!!navigator.brave,handle:null,granted:false,downloads:false,since:null,
|
||||||
saved:new Map(),busy:false,status:'',error:'',last:null,lastSig:null};
|
saved:new Map(),busy:false,status:'',error:'',last:null,lastSig:null,
|
||||||
|
// Passes in a row each file was held open by another program (DTF-WEB-M).
|
||||||
|
locked:new Map()};
|
||||||
|
const LOCKED_REPORT_PASSES=10;
|
||||||
// When the folders were chosen: every order paid since then ends up in them,
|
// When the folders were chosen: every order paid since then ends up in them,
|
||||||
// even one that went through while this computer was off (Dropstar's rules,
|
// even one that went through while this computer was off (Dropstar's rules,
|
||||||
// 2026-10-26). Folders chosen before this existed count from their first round.
|
// 2026-10-26). Folders chosen before this existed count from their first round.
|
||||||
@@ -610,11 +613,19 @@ async function syncFolder(force=false){
|
|||||||
if(moved)say(moved+' arquivo(s) mudaram de pasta com o pedido.');
|
if(moved)say(moved+' arquivo(s) mudaram de pasta com o pedido.');
|
||||||
if(removed)say(removed+' arquivo(s) de pedidos cancelados, excluídos, em correção, trocados ou finalizados há mais de '+KEEP_FINISHED_DAYS+' dias saíram das pastas.');
|
if(removed)say(removed+' arquivo(s) de pedidos cancelados, excluídos, em correção, trocados ou finalizados há mais de '+KEEP_FINISHED_DAYS+' dias saíram das pastas.');
|
||||||
// What another program held open waits for the next pass; the rest is done.
|
// What another program held open waits for the next pass; the rest is done.
|
||||||
|
// Expected while the FlexiPRINT reads a file: a warning the first time, and
|
||||||
|
// an error (which reaches Sentry) only when the same file is still held
|
||||||
|
// after LOCKED_REPORT_PASSES passes (Sentry DTF-WEB-M).
|
||||||
|
for(const name of [...FOLDER.locked.keys()])if(!locked.includes(name))FOLDER.locked.delete(name);
|
||||||
|
for(const name of locked)FOLDER.locked.set(name,(FOLDER.locked.get(name)||0)+1);
|
||||||
if(locked.length){
|
if(locked.length){
|
||||||
FOLDER.lastSig=null;
|
FOLDER.lastSig=null;
|
||||||
FOLDER.error='O arquivo '+locked[0]+(locked.length>1?' e mais '+(locked.length-1):'')+
|
FOLDER.error='O arquivo '+locked[0]+(locked.length>1?' e mais '+(locked.length-1):'')+
|
||||||
' está aberto em outro programa (o FlexiPRINT, por exemplo). Os outros foram gravados; o Kanban tenta este de novo em 30 s.';
|
' está aberto em outro programa (o FlexiPRINT, por exemplo). Os outros foram gravados; o Kanban tenta este de novo em 30 s.';
|
||||||
say('Pastas automáticas: '+FOLDER.error,true);
|
const stuck=locked.filter(name=>FOLDER.locked.get(name)===LOCKED_REPORT_PASSES);
|
||||||
|
if(stuck.length)say('Pastas automáticas: o arquivo '+stuck.join(', ')+' segue aberto em outro programa há '+
|
||||||
|
Math.round(LOCKED_REPORT_PASSES*30/60)+' minutos. Feche-o no programa que o usa.',true);
|
||||||
|
else if(locked.some(name=>FOLDER.locked.get(name)===1))say('Pastas automáticas: '+FOLDER.error);
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){
|
||||||
if(e.name==='NotAllowedError')FOLDER.granted=false;
|
if(e.name==='NotAllowedError')FOLDER.granted=false;
|
||||||
|
|||||||
Reference in New Issue
Block a user