fix: the folders change only the files of orders the server answered for
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 8m7s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m21s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 8m7s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m21s
The Kanban asks the server about at most 1000 orders a pass; an order left out had no state in the answer and was taken for deleted, so its files left the folders although it was still in Correção or Revisão. Orders still in the flow are asked first, then those in Finalizado, and a file whose order was not asked this pass stays as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -626,7 +626,14 @@ async function syncFolder(force=false){
|
||||
FOLDER.busy=true;
|
||||
try{
|
||||
if(stages)await makeStageFolders();
|
||||
const held=stages?[...new Set([...FOLDER.saved.values()].filter(r=>!r.review).map(r=>r.order).filter(Boolean))].slice(-1000):[];
|
||||
// The server answers for up to 1000 orders a pass: the ones still in the
|
||||
// flow first, then those in Finalizado. A file whose order was not asked
|
||||
// this time stays as it is; only an order the server says is gone,
|
||||
// cancelled or moved changes its files.
|
||||
const records=[...FOLDER.saved.values()].filter(r=>!r.review&&r.order);
|
||||
const held=stages?[...new Set([...records.filter(r=>r.folder!==STAGE_FOLDERS.fin),...records.filter(r=>r.folder===STAGE_FOLDERS.fin)]
|
||||
.map(r=>r.order))].slice(0,1000):[];
|
||||
const asked=new Set(held);
|
||||
const {files,states,receipts=[],reviews=[]}=await api('/queue/folder',{early:stages,held,since:stages?FOLDER.since||await folderSince():null});
|
||||
// By file: an item longer than a part (10 m) is several parts (item 13), each its own file.
|
||||
const wanted=new Map(files.map(f=>[f.upload_id,f]));
|
||||
@@ -642,7 +649,7 @@ async function syncFolder(force=false){
|
||||
...(folder===STAGE_FOLDERS.fin?{at:file.at||Date.now()}:{})});
|
||||
FOLDER.last=new Date();await keepSaved();};
|
||||
if(stages)for(const [uid,rec] of [...FOLDER.saved])await step(rec.name,async()=>{
|
||||
if(!rec.order||!rec.folder)return;
|
||||
if(!rec.order||!rec.folder||!asked.has(rec.order))return;
|
||||
const state=states[rec.order], target=STAGE_FOLDERS[state];
|
||||
const now=wanted.get(uid);
|
||||
const replaced=(state==='rec'||state==='tra')&&(!now||now.order!==rec.order);
|
||||
|
||||
Reference in New Issue
Block a user