@effect/cluster 0.48.14 → 0.48.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Runners.ts CHANGED
@@ -122,6 +122,7 @@ export const make: (options: Omit<Runners["Type"], "sendLocal" | "notifyLocal">)
122
122
  MessageStorage.MessageStorage | Snowflake.Generator | ShardingConfig | Scope
123
123
  > = Effect.fnUntraced(function*(options: Omit<Runners["Type"], "sendLocal" | "notifyLocal">) {
124
124
  const storage = yield* MessageStorage.MessageStorage
125
+ const runnersScope = yield* Effect.scope
125
126
  const snowflakeGen = yield* Snowflake.Generator
126
127
  const config = yield* ShardingConfig
127
128
 
@@ -297,7 +298,7 @@ export const make: (options: Omit<Runners["Type"], "sendLocal" | "notifyLocal">)
297
298
  }
298
299
  }).pipe(
299
300
  Effect.interruptible,
300
- Effect.forkScoped
301
+ Effect.forkIn(runnersScope)
301
302
  )
302
303
 
303
304
  yield* Effect.suspend(() => {
@@ -309,7 +310,7 @@ export const make: (options: Omit<Runners["Type"], "sendLocal" | "notifyLocal">)
309
310
  Effect.delay(config.entityReplyPollInterval),
310
311
  Effect.forever,
311
312
  Effect.interruptible,
312
- Effect.forkScoped
313
+ Effect.forkIn(runnersScope)
313
314
  )
314
315
  }
315
316
 
@@ -370,7 +371,15 @@ export const make: (options: Omit<Runners["Type"], "sendLocal" | "notifyLocal">)
370
371
  () => Effect.void
371
372
  )
372
373
  } else if (!duplicate) {
373
- return storage.registerReplyHandler(message).pipe(
374
+ return storage.registerReplyHandler(
375
+ message,
376
+ Effect.suspend(() =>
377
+ replyFromStorage(message).pipe(
378
+ Effect.forkIn(runnersScope),
379
+ Effect.interruptible
380
+ )
381
+ )
382
+ ).pipe(
374
383
  Effect.andThen(options.notify(Message.incomingLocalFromOutgoing(message))),
375
384
  Effect.catchTag("EntityNotAssignedToRunner", () => Effect.void)
376
385
  )
@@ -171,7 +171,7 @@ export const make = Effect.fnUntraced(function*<
171
171
  Exit.isInterrupted(response.exit) &&
172
172
  (isShuttingDown || Context.get(request.rpc.annotations, Uninterruptible))
173
173
  ) {
174
- return Effect.void
174
+ return options.storage.unregisterReplyHandler(request.message.envelope.requestId)
175
175
  }
176
176
  return retryRespond(
177
177
  4,