MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / bindSigusr1

Method bindSigusr1

packages/agent-core/src/agent/cron/manager.ts:533–551  ·  view source on GitHub ↗

* Wire `SIGUSR1` to a manual `tick()` so bench scripts can advance the * scheduler with `kill -USR1 ` without a custom RPC. * * Gated on `KIMI_CRON_MANUAL_TICK=1` for two reasons: * * 1. SIGUSR1 only makes sense when auto-tick is off. When the 1s * interval is running,

()

Source from the content-addressed store, hash-verified

531 * see a bad tick.
532 */
533 private bindSigusr1(): void {
534 if (process.platform === 'win32') return;
535 if (process.env['KIMI_CRON_MANUAL_TICK'] !== '1') return;
536 if (this.sigusr1Handler !== null) return;
537 const handler: NodeJS.SignalsListener = () => {
538 try {
539 this.tick();
540 } catch (error) {
541 if (process.env['KIMI_CRON_DEBUG'] === '1') {
542 const msg = error instanceof Error ? error.message : String(error);
543 process.stderr.write(
544 `[cron/manager] SIGUSR1 tick threw: ${msg}\n`,
545 );
546 }
547 }
548 };
549 this.sigusr1Handler = handler;
550 process.on('SIGUSR1', handler);
551 }
552
553 /**
554 * Detach the SIGUSR1 listener registered by `bindSigusr1`. Safe to

Callers 1

startMethod · 0.95

Calls 1

onMethod · 0.65

Tested by

no test coverage detected