(input: {
readonly check: Effect.Effect<boolean, E, R>;
readonly expected: boolean;
readonly timeoutMs: number;
readonly intervalMs: number;
})
| 184 | : signalPid(-child.pid).pipe(Effect.catch(() => signalPid(child.pid))); |
| 185 | |
| 186 | const waitForCondition = <E, R>(input: { |
| 187 | readonly check: Effect.Effect<boolean, E, R>; |
| 188 | readonly expected: boolean; |
| 189 | readonly timeoutMs: number; |
| 190 | readonly intervalMs: number; |
| 191 | }): Effect.Effect<boolean, E, R> => |
| 192 | Effect.gen(function* () { |
| 193 | const startedAt = yield* Clock.currentTimeMillis; |
| 194 | while (true) { |
| 195 | const reachable = yield* input.check; |
| 196 | if (reachable === input.expected) return true; |
| 197 | |
| 198 | const now = yield* Clock.currentTimeMillis; |
| 199 | if (now - startedAt >= input.timeoutMs) return false; |
| 200 | |
| 201 | yield* Effect.sleep(input.intervalMs); |
| 202 | } |
| 203 | }); |
| 204 | |
| 205 | export const waitForReachable = <E, R>(input: { |
| 206 | readonly check: Effect.Effect<boolean, E, R>; |
no outgoing calls
no test coverage detected