MCPcopy
hub / github.com/anomalyco/opencode / poll

Function poll

packages/opencode/src/cli/cmd/account.ts:54–61  ·  view source on GitHub ↗
(wait: Duration.Duration)

Source from the content-addressed store, hash-verified

52 yield* s.start("Waiting for authorization...")
53
54 const poll = (wait: Duration.Duration): Effect.Effect<PollResult, AccountError> =>
55 Effect.gen(function* () {
56 yield* Effect.sleep(wait)
57 const result = yield* service.poll(login)
58 if (result._tag === "PollPending") return yield* poll(wait)
59 if (result._tag === "PollSlow") return yield* poll(Duration.sum(wait, Duration.seconds(5)))
60 return result
61 })
62
63 const result = yield* poll(login.interval).pipe(
64 Effect.timeout(login.expiry),

Callers 4

account.tsFile · 0.70
createLayerFunction · 0.50
AthenaClass · 0.50
athena.tsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected