MCPcopy
hub / github.com/simstudioai/sim / readLastFiredAt

Function readLastFiredAt

apps/sim/lib/workspace-events/state.ts:10–28  ·  view source on GitHub ↗
(
  workflowId: string,
  blockId: string,
  scopeKey: string
)

Source from the content-addressed store, hash-verified

8 * {@link claimCooldown} remains the source of truth.
9 */
10export async function readLastFiredAt(
11 workflowId: string,
12 blockId: string,
13 scopeKey: string
14): Promise<Date | null> {
15 const rows = await db
16 .select({ lastFiredAt: simTriggerState.lastFiredAt })
17 .from(simTriggerState)
18 .where(
19 and(
20 eq(simTriggerState.workflowId, workflowId),
21 eq(simTriggerState.blockId, blockId),
22 eq(simTriggerState.scopeKey, scopeKey)
23 )
24 )
25 .limit(1)
26
27 return rows[0]?.lastFiredAt ?? null
28}
29
30/**
31 * Atomically claims a cooldown slot for a subscription scope.

Callers 2

checkWatchedWorkflowFunction · 0.90

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected