MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / scheduleIdleShutdown

Function scheduleIdleShutdown

src/index.ts:1770–1787  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1768 };
1769
1770 const scheduleIdleShutdown = () => {
1771 clearIdleTimer();
1772 if (!mcpClientInitialized || STDIO_IDLE_TIMEOUT_MS <= 0 || activeSessionWork > 0) {
1773 return;
1774 }
1775
1776 idleTimer = setTimeout(() => {
1777 if (!mcpClientInitialized || activeSessionWork > 0) {
1778 return;
1779 }
1780
1781 console.error(
1782 `No MCP activity for ${Math.round(STDIO_IDLE_TIMEOUT_MS / 1000)}s after initialize - exiting idle stdio session.`
1783 );
1784 shutdown(0);
1785 }, STDIO_IDLE_TIMEOUT_MS);
1786 idleTimer.unref();
1787 };
1788
1789 noteSessionActivity = () => {
1790 scheduleIdleShutdown();

Callers 1

mainFunction · 0.85

Calls 2

clearIdleTimerFunction · 0.85
shutdownFunction · 0.85

Tested by

no test coverage detected