MCPcopy Index your code
hub / github.com/anomalyco/opencode / waitForPending

Function waitForPending

packages/opencode/test/permission/next.test.ts:35–50  ·  view source on GitHub ↗
(count: number)

Source from the content-addressed store, hash-verified

33 })
34
35const waitForPending = (count: number) =>
36 Effect.gen(function* () {
37 const permission = yield* Permission.Service
38 return yield* Effect.gen(function* () {
39 while (true) {
40 const list = yield* permission.list()
41 if (list.length === count) return list
42 yield* Effect.sleep("10 millis")
43 }
44 }).pipe(
45 Effect.timeoutOrElse({
46 duration: "1 second",
47 orElse: () => Effect.fail(new Error(`timed out waiting for ${count} pending permission request(s)`)),
48 }),
49 )
50 })
51
52const fail = <A, E, R>(self: Effect.Effect<A, E, R>) =>
53 Effect.gen(function* () {

Callers 2

next.test.tsFile · 0.85
question.test.tsFile · 0.85

Calls 1

listMethod · 0.65

Tested by

no test coverage detected