MCPcopy Create free account
hub / github.com/EvoMap/evolver / _registerProcessWakeHooks

Function _registerProcessWakeHooks

index.js:309–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307// re-register idempotently).
308let _wakeHooksRegistered = false;
309function _registerProcessWakeHooks() {
310 if (_wakeHooksRegistered) return;
311 try {
312 const a2a = require('./src/gep/a2aProtocol.js');
313 if (typeof a2a.registerWakeHook !== 'function') return;
314 a2a.registerWakeHook(function () {
315 try { _interruptAllSleeps(); } catch (_) {}
316 });
317 // R13: guards.sleepMs is a separate private helper used for 60-120s
318 // backoffs inside evolve.run() arms (active-sessions, system-load,
319 // pending-solidify). Without this hook, a guard sleep that spans
320 // macOS suspend would block the cycle for the full window on the
321 // resumed monotonic clock even though the outer sleep was interrupted.
322 a2a.registerWakeHook(function () {
323 try {
324 const guards = require('./src/evolve/guards');
325 if (guards && typeof guards._interruptGuardSleeps === 'function') {
326 guards._interruptGuardSleeps();
327 }
328 } catch (_) {}
329 });
330 a2a.registerWakeHook(function () {
331 try {
332 const v = require('./src/gep/validator');
333 if (v && typeof v.pokeValidatorDaemon === 'function') {
334 v.pokeValidatorDaemon();
335 }
336 } catch (_) {}
337 });
338 _wakeHooksRegistered = true;
339 } catch (_) {}
340}
341
342function readJsonSafe(p) {
343 try {

Callers 1

mainFunction · 0.85

Calls 1

_interruptAllSleepsFunction · 0.85

Tested by

no test coverage detected