MCPcopy Create free account
hub / github.com/codeaashu/claude-code / addSlowOperation

Function addSlowOperation

src/bootstrap/state.ts:1569–1587  ·  view source on GitHub ↗
(operation: string, durationMs: number)

Source from the content-addressed store, hash-verified

1567const SLOW_OPERATION_TTL_MS = 10000
1568
1569export function addSlowOperation(operation: string, durationMs: number): void {
1570 if (process.env.USER_TYPE !== 'ant') return
1571 // Skip tracking for editor sessions (user editing a prompt file in $EDITOR)
1572 // These are intentionally slow since the user is drafting text
1573 if (operation.includes('exec') && operation.includes('claude-prompt-')) {
1574 return
1575 }
1576 const now = Date.now()
1577 // Remove stale operations
1578 STATE.slowOperations = STATE.slowOperations.filter(
1579 op => now - op.timestamp < SLOW_OPERATION_TTL_MS,
1580 )
1581 // Add new operation
1582 STATE.slowOperations.push({ operation, durationMs, timestamp: now })
1583 // Keep only the most recent operations
1584 if (STATE.slowOperations.length > MAX_SLOW_OPERATIONS) {
1585 STATE.slowOperations = STATE.slowOperations.slice(-MAX_SLOW_OPERATIONS)
1586 }
1587}
1588
1589const EMPTY_SLOW_OPERATIONS: ReadonlyArray<{
1590 operation: string

Callers 1

[Symbol.dispose]Method · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected