MCPcopy Create free account
hub / github.com/Noumena-Network/code / resetStreamIdleTimer

Function resetStreamIdleTimer

src/services/api/claude.ts:1922–1955  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1920 }
1921 }
1922 function resetStreamIdleTimer(): void {
1923 clearStreamIdleTimers()
1924 if (!streamWatchdogEnabled) {
1925 return
1926 }
1927 streamIdleWarningTimer = setTimeout(
1928 warnMs => {
1929 logForDebugging(
1930 `Streaming idle warning: no chunks received for ${warnMs / 1000}s`,
1931 { level: 'warn' },
1932 )
1933 logForDiagnosticsNoPII('warn', 'cli_streaming_idle_warning')
1934 },
1935 STREAM_IDLE_WARNING_MS,
1936 STREAM_IDLE_WARNING_MS,
1937 )
1938 streamIdleTimer = setTimeout(() => {
1939 streamIdleAborted = true
1940 streamWatchdogFiredAt = performance.now()
1941 logForDebugging(
1942 `Streaming idle timeout: no chunks received for ${STREAM_IDLE_TIMEOUT_MS / 1000}s, aborting stream`,
1943 { level: 'error' },
1944 )
1945 logForDiagnosticsNoPII('error', 'cli_streaming_idle_timeout')
1946 logEvent('ncode_streaming_idle_timeout', {
1947 model:
1948 options.model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
1949 request_id: (streamRequestId ??
1950 'unknown') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
1951 timeout_ms: STREAM_IDLE_TIMEOUT_MS,
1952 })
1953 releaseStreamResources()
1954 }, STREAM_IDLE_TIMEOUT_MS)
1955 }
1956 resetStreamIdleTimer()
1957
1958 startSessionActivity('api_call')

Callers 1

queryModelFunction · 0.85

Calls 5

clearStreamIdleTimersFunction · 0.85
logForDiagnosticsNoPIIFunction · 0.85
releaseStreamResourcesFunction · 0.85
logEventFunction · 0.70
logForDebuggingFunction · 0.50

Tested by

no test coverage detected