(logs: StepProgressLog[])
| 56 | export const flushLogs = sendLogSignal.flush; |
| 57 | |
| 58 | export const logProgress = (logs: StepProgressLog[]) => { |
| 59 | if (logs.length === 0) { |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | const { workflowId, runId } = Context.current().info.workflowExecution ?? {}; |
| 64 | |
| 65 | if (!workflowId) { |
| 66 | throw new Error( |
| 67 | "No workflowId associated with the current workflow execution", |
| 68 | ); |
| 69 | } |
| 70 | |
| 71 | if (!runId) { |
| 72 | throw new Error("No runId associated with the current workflow execution"); |
| 73 | } |
| 74 | |
| 75 | const existingLogs = logQueueByRunId.get(runId) ?? []; |
| 76 | |
| 77 | existingLogs.push(...logs); |
| 78 | |
| 79 | logQueueByRunId.set(runId, existingLogs); |
| 80 | |
| 81 | void sendLogSignal({ workflowId, runId }); |
| 82 | }; |
no test coverage detected