← back to Designer Wallcoverings
Fleet room-image push: one-shot FLEET COMPLETE alert (CNCP win + George email) on zero remaining
7a711a9effc85b9d80cb926dd57ae327e08a3518 · 2026-06-26 10:30:46 -0700 · Steve Abrams
Files touched
M scripts/room-image-push/fleet-room-push.cjs
Diff
commit 7a711a9effc85b9d80cb926dd57ae327e08a3518
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri Jun 26 10:30:46 2026 -0700
Fleet room-image push: one-shot FLEET COMPLETE alert (CNCP win + George email) on zero remaining
---
scripts/room-image-push/fleet-room-push.cjs | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/scripts/room-image-push/fleet-room-push.cjs b/scripts/room-image-push/fleet-room-push.cjs
index a8310698..705e253b 100644
--- a/scripts/room-image-push/fleet-room-push.cjs
+++ b/scripts/room-image-push/fleet-room-push.cjs
@@ -43,8 +43,19 @@ function req(method,p,body){return new Promise((res,rej)=>{const data=body?JSON.
if(allPresent && addedThisRun<DAILY_CAP) doneSet.add(p.mfr_sku);
}
ledger.done=[...doneSet]; ledger.runs=(ledger.runs||0)+1; ledger.startedAt=ledger.startedAt||new Date().toISOString();
- if(!DRY) fs.writeFileSync(LEDGER,JSON.stringify(ledger,null,2));
const remaining=workset.filter(p=>!doneSet.has(p.mfr_sku)).length;
+
+ // ── one-shot completion alert (fires exactly once when the fleet first hits 0) ──
+ function notify(host,port,path,headers,payload){return new Promise(res=>{const data=JSON.stringify(payload);
+ const r=require('http').request({host,port,path,method:'POST',headers:{'Content-Type':'application/json','Content-Length':Buffer.byteLength(data),...headers}},rs=>{rs.on('data',()=>{});rs.on('end',()=>res(rs.statusCode));});r.on('error',()=>res(0));r.setTimeout(8000,()=>{r.destroy();res(0);});r.write(data);r.end();});}
+ if(remaining===0 && !DRY && !ledger.completedNotified){
+ const total=ledger.added||0;
+ try{ await notify('127.0.0.1',3333,'/api/wins',{},{project:'Designer-Wallcoverings',title:'Quadrille room-settings → live PDPs: FLEET COMPLETE',summary:`Pushed ${total} credited editorial room images (top-3/SKU) across the full live China Seas/Quadrille catalog over ${ledger.runs} nightly runs. Image-only, primary photos untouched, credit in alt-text.`}); }catch(e){}
+ try{ await notify('127.0.0.1',9850,'/api/send',{'Authorization':'Basic '+Buffer.from('admin:').toString('base64')},{account:'steve-office',to:'steve@designerwallcoverings.com',subject:'✅ Quadrille room-image fleet push COMPLETE',body:`<p>The nightly room-image cadence finished.</p><ul><li><strong>${total}</strong> credited editorial room images pushed (top-3/SKU) across the full live China Seas + Quadrille-house catalog.</li><li>Image-only — primary product photos untouched, credit in each image's alt-text.</li><li>Completed over ${ledger.runs} nightly runs.</li></ul><p>Safe to unload the job: <code>launchctl bootout gui/$(id -u)/com.steve.dw-room-image-push</code></p>`}); }catch(e){}
+ ledger.completedNotified=true;
+ }
+
+ if(!DRY) fs.writeFileSync(LEDGER,JSON.stringify(ledger,null,2));
console.log(JSON.stringify({dry:DRY, addedThisRun, skipped, failed, skusTouched, skusDone:doneSet.size, skusRemaining:remaining, totalAddedAllRuns:ledger.added||0},null,2));
- if(remaining===0) console.log('FLEET COMPLETE — safe to unload the launchd job.');
+ if(remaining===0) console.log('FLEET COMPLETE — alert '+(ledger.completedNotified?'sent':'pending')+'; safe to unload the launchd job.');
})();
← 01415495 Fix metafield-scrub delete to use metafieldsDelete (collecti
·
back to Designer Wallcoverings
·
auto-save: 2026-06-26T10:45:01 (8 files) — pending-approval/ 974c7dd0 →