chore: generate
This commit is contained in:
parent
4e143e3a3e
commit
78769010a1
1 changed files with 13 additions and 12 deletions
|
|
@ -180,20 +180,21 @@ Wait on a **published readiness signal**, not wall-clock time. Available afforda
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
// Antipattern — race
|
// Antipattern — race
|
||||||
yield* prompt.shell({ command: "sleep 30" }).pipe(Effect.forkChild)
|
yield * prompt.shell({ command: "sleep 30" }).pipe(Effect.forkChild)
|
||||||
yield* Effect.sleep(50)
|
yield * Effect.sleep(50)
|
||||||
yield* prompt.cancel(chat.id)
|
yield * prompt.cancel(chat.id)
|
||||||
|
|
||||||
// Fix — wait for a published readiness signal
|
// Fix — wait for a published readiness signal
|
||||||
yield* prompt.shell({ command: "sleep 30" }).pipe(Effect.forkChild)
|
yield * prompt.shell({ command: "sleep 30" }).pipe(Effect.forkChild)
|
||||||
yield* pollWithTimeout(
|
yield *
|
||||||
Effect.gen(function* () {
|
pollWithTimeout(
|
||||||
const s = yield* (yield* SessionStatus.Service).get(chat.id)
|
Effect.gen(function* () {
|
||||||
return s.type === "busy" ? (true as const) : undefined
|
const s = yield* (yield* SessionStatus.Service).get(chat.id)
|
||||||
}),
|
return s.type === "busy" ? (true as const) : undefined
|
||||||
"session never became busy",
|
}),
|
||||||
)
|
"session never became busy",
|
||||||
yield* prompt.cancel(chat.id)
|
)
|
||||||
|
yield * prompt.cancel(chat.id)
|
||||||
```
|
```
|
||||||
|
|
||||||
### When Fixed Sleeps Are OK
|
### When Fixed Sleeps Are OK
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue