A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys, Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun VPN routing, and a web dashboard to manage it all. Free & open forever to self-host; optional paid hosted services fund it. See PROMISE.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
23 lines
923 B
JavaScript
23 lines
923 B
JavaScript
// Best-effort wake-up signal for the host-side bash task processor.
|
|
//
|
|
// The FIFO carries no meaningful payload — it's just a poke to make the
|
|
// processor poll sooner than its 3 s idle scan. So `pokeFifo` is
|
|
// non-blocking by design:
|
|
// - O_NONBLOCK on open means we don't wedge the Node event loop when no
|
|
// reader is attached (the previous writeFileSync would hang forever
|
|
// in that case, surfacing as "NetworkError failed to fetch" in the UI
|
|
// when the request never returned).
|
|
// - All errors are swallowed; the processor will pick the task up from
|
|
// the on-disk JSON via its idle scan even if the wake-up is lost.
|
|
|
|
const fs = require('fs');
|
|
|
|
function pokeFifo(fifoPath, taskId) {
|
|
fs.open(fifoPath, fs.constants.O_WRONLY | fs.constants.O_NONBLOCK, (err, fd) => {
|
|
if (err) return;
|
|
fs.write(fd, `${taskId}\n`, () => fs.close(fd, () => {}));
|
|
});
|
|
}
|
|
|
|
module.exports = { pokeFifo };
|