MCPcopy Create free account
hub / github.com/freecodexyz/free-code / triggerFastModeCooldown

Function triggerFastModeCooldown

src/utils/fastMode.ts:214–233  ·  view source on GitHub ↗
(
  resetTimestamp: number,
  reason: CooldownReason,
)

Source from the content-addressed store, hash-verified

212}
213
214export function triggerFastModeCooldown(
215 resetTimestamp: number,
216 reason: CooldownReason,
217): void {
218 if (!isFastModeEnabled()) {
219 return
220 }
221 runtimeState = { status: 'cooldown', resetAt: resetTimestamp, reason }
222 hasLoggedCooldownExpiry = false
223 const cooldownDurationMs = resetTimestamp - Date.now()
224 logForDebugging(
225 `Fast mode cooldown triggered (${reason}), duration ${Math.round(cooldownDurationMs / 1000)}s`,
226 )
227 logEvent('tengu_fast_mode_fallback_triggered', {
228 cooldown_duration_ms: cooldownDurationMs,
229 cooldown_reason:
230 reason as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
231 })
232 cooldownTriggered.emit(resetTimestamp, reason)
233}
234
235export function clearFastModeCooldown(): void {
236 runtimeState = { status: 'active' }

Callers 1

withRetryFunction · 0.85

Calls 4

isFastModeEnabledFunction · 0.85
logForDebuggingFunction · 0.85
logEventFunction · 0.85
emitMethod · 0.80

Tested by

no test coverage detected