(
workflow: {
readonly poll: (
executionId: string
) => Effect.Effect<Option.Option<Workflow.Result<A, E>>, never, R>
},
executionId: string
)
| 157 | |
| 158 | const waitForSequentialWorkflowSuspended = (executionId: string) => |
| 159 | waitForSuspended(SequentialDeferredWorkflow, executionId) |
| 160 | |
| 161 | const waitForSuspended = <A, E, R>( |
| 162 | workflow: { |
| 163 | readonly poll: ( |
| 164 | executionId: string |
| 165 | ) => Effect.Effect<Option.Option<Workflow.Result<A, E>>, never, R> |
| 166 | }, |
| 167 | executionId: string |
| 168 | ) => |
| 169 | Effect.gen(function*() { |
| 170 | const sharding = yield* Sharding.Sharding |
| 171 | for (let i = 0; i < 100; i++) { |
| 172 | yield* sharding.pollStorage |
| 173 | const polled = yield* workflow.poll(executionId) |
| 174 | if (Option.isSome(polled) && polled.value._tag === "Suspended") return |
| 175 | yield* Effect.sleep(Duration.millis(100)) |
| 176 | } |
| 177 | return yield* Effect.fail(new Error(`Workflow ${executionId} did not suspend`)) |
| 178 | }) |
| 179 |
no test coverage detected
searching dependent graphs…