0.2.2 #31
@@ -106,12 +106,11 @@ export const service = <K extends readonly any[], A, E = never, R = never, P = n
|
|||||||
|
|
||||||
export const run = <K extends readonly any[], A, E, R, P>(
|
export const run = <K extends readonly any[], A, E, R, P>(
|
||||||
self: Query<K, A, E, R, P>
|
self: Query<K, A, E, R, P>
|
||||||
): Effect.Effect<void, never, Scope.Scope | R> => Stream.runForEach(self.key, key =>
|
): Effect.Effect<void, never, Scope.Scope | R> => {
|
||||||
(self as QueryImpl<K, A, E, R, P>).interrupt.pipe(
|
const _self = self as QueryImpl<K, A, E, R, P>
|
||||||
Effect.andThen(SubscriptionRef.set((self as QueryImpl<K, A, E, R, P>).latestKey, Option.some(key))),
|
return Stream.runForEach(_self.key, key => _self.interrupt.pipe(
|
||||||
Effect.andThen((self as QueryImpl<K, A, E, R, P>).start(key)),
|
Effect.andThen(SubscriptionRef.set(_self.latestKey, Option.some(key))),
|
||||||
Effect.andThen(sub => Effect.forkScoped(
|
Effect.andThen(_self.start(key)),
|
||||||
(self as QueryImpl<K, A, E, R, P>).watch(sub)
|
Effect.andThen(sub => Effect.forkScoped(_self.watch(sub))),
|
||||||
)),
|
))
|
||||||
)
|
}
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user