MCPcopy Index your code
hub / github.com/simstudioai/sim / setMarker

Function setMarker

apps/sim/lib/logs/execution/progress-markers.ts:67–96  ·  view source on GitHub ↗

* Write a marker field under the monotonic guard, refreshing the key TTL. The * TTL is a backstop for executions that die without a terminal/pause boundary * (deterministic cleanup is clearProgressMarkers); it mirrors the * admission-reservation TTL so a crashed run's marker key and slot

(
  executionId: string,
  field: string,
  timestampField: 'startedAt' | 'endedAt',
  timestamp: string,
  marker: ExecutionLastStartedBlock | ExecutionLastCompletedBlock
)

Source from the content-addressed store, hash-verified

65 * so callers can fall back to the SQL path on a missing client or a failure.
66 */
67async function setMarker(
68 executionId: string,
69 field: string,
70 timestampField: 'startedAt' | 'endedAt',
71 timestamp: string,
72 marker: ExecutionLastStartedBlock | ExecutionLastCompletedBlock
73): Promise<boolean> {
74 const redis = getMarkerClient()
75 if (!redis) return false
76
77 try {
78 await redis.eval(
79 SET_MARKER_SCRIPT,
80 1,
81 markerKey(executionId),
82 field,
83 timestampField,
84 timestamp,
85 JSON.stringify(marker),
86 getExecutionReservationTtlMs().toString()
87 )
88 return true
89 } catch (error) {
90 logger.error(`Failed to persist progress marker for execution ${executionId}`, {
91 field,
92 error: toError(error).message,
93 })
94 return false
95 }
96}
97
98/**
99 * Persist the last-started-block marker. Returns `false` (caller should fall

Callers 2

setLastStartedBlockFunction · 0.85
setLastCompletedBlockFunction · 0.85

Calls 6

toErrorFunction · 0.90
getMarkerClientFunction · 0.85
markerKeyFunction · 0.85
errorMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected