( executionId: string )
| 208 | * never wipes the only copy of markers that are still in Redis. |
| 209 | */ |
| 210 | export async function getProgressMarkers( |
| 211 | executionId: string |
| 212 | ): Promise<ExecutionProgressMarkers | null> { |
| 213 | const redis = getMarkerClient() |
| 214 | if (!redis) return {} |
| 215 | |
| 216 | try { |
| 217 | const fields = await redis.hgetall(markerKey(executionId)) |
| 218 | if (!fields || Object.keys(fields).length === 0) return {} |
| 219 | |
| 220 | const result: ExecutionProgressMarkers = {} |
| 221 | const started = parseStartedMarker(fields[STARTED_FIELD]) |
| 222 | if (started) result.lastStartedBlock = started |
| 223 | const completed = parseCompletedMarker(fields[COMPLETED_FIELD]) |
| 224 | if (completed) result.lastCompletedBlock = completed |
| 225 | return result |
| 226 | } catch (error) { |
| 227 | logger.error(`Failed to read progress markers for execution ${executionId}`, { |
| 228 | error: toError(error).message, |
| 229 | }) |
| 230 | return null |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Delete the markers for an execution. Called at every terminal/pause boundary |
no test coverage detected