[object Object]

← back to Factory Floor

fix: non-blocking initial poll + 30s timeout (box was at load avg 343)

e87d5a895f2300451280cc11d8d1974bc5b17103 · 2026-05-10 21:05:30 -0700 · Steve Abrams

Files touched

Diff

commit e87d5a895f2300451280cc11d8d1974bc5b17103
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun May 10 21:05:30 2026 -0700

    fix: non-blocking initial poll + 30s timeout (box was at load avg 343)
---
 scripts/snap.mjs | 16 ++++++++++++++++
 server.js        |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/scripts/snap.mjs b/scripts/snap.mjs
new file mode 100644
index 0000000..50006e4
--- /dev/null
+++ b/scripts/snap.mjs
@@ -0,0 +1,16 @@
+#!/usr/bin/env node
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const OUT = path.join(__dirname, '..', 'snapshot.png');
+
+const { chromium } = await import('/Users/stevestudio2/Projects/animals/node_modules/playwright/index.mjs');
+const browser = await chromium.launch();
+const ctx = await browser.newContext({ viewport: { width: 1600, height: 1100 }, deviceScaleFactor: 2 });
+const page = await ctx.newPage();
+await page.goto('http://127.0.0.1:9700', { waitUntil: 'domcontentloaded', timeout: 60000 });
+await page.waitForSelector('main .card', { timeout: 60000 });
+await page.waitForTimeout(4000);
+await page.screenshot({ path: OUT, fullPage: true });
+await browser.close();
+console.log(`✓ ${OUT}`);
diff --git a/server.js b/server.js
index 68610af..8992956 100644
--- a/server.js
+++ b/server.js
@@ -16,7 +16,7 @@ const PROJECTS_DIR = path.join(os.homedir(), 'Projects');
 const SERVICES = JSON.parse(fs.readFileSync(path.join(__dirname, 'services.json'), 'utf8')).services;
 
 const run = (cmd, args, opts = {}) => new Promise((res) => {
-  execFile(cmd, args, { timeout: 8000, maxBuffer: 16 * 1024 * 1024, ...opts }, (err, stdout, stderr) =>
+  execFile(cmd, args, { timeout: 30000, maxBuffer: 16 * 1024 * 1024, ...opts }, (err, stdout, stderr) =>
     res({ err, stdout: stdout?.toString() || '', stderr: stderr?.toString() || '' })
   );
 });
@@ -118,7 +118,7 @@ async function refresh() {
   STATE = { generated_at: new Date().toISOString(), poll_ms: Date.now() - t0, pm2, ollama, services, git, host };
 }
 
-await refresh();
+refresh().catch(e => console.error('initial refresh err', e.message));
 setInterval(() => { refresh().catch(e => console.error('refresh err', e.message)); }, POLL_MS);
 
 const server = http.createServer(async (req, res) => {

← 1a2720b initial scaffold: factory-floor unified live-status grid on  ·  back to Factory Floor  ·  feat: Big Red tile w/ spinning brain + model picker (Ollama 282ec29 →