( workflowId: string, blockId: string, scopeKey: string )
| 8 | * {@link claimCooldown} remains the source of truth. |
| 9 | */ |
| 10 | export 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. |
no test coverage detected