Skip to content

Commit 95b51be

Browse files
committed
don't add proxy to FiberId
1 parent ee5556f commit 95b51be

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/effect/src/internal/cause.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const interrupt = (fiberId: FiberId.FiberId): Cause.Cause<never> => {
109109
const o = Object.create(proto)
110110
o._tag = OpCodes.OP_INTERRUPT
111111
o.fiberId = fiberId
112-
return rehydrateAnnotations(o, fiberId)
112+
return o
113113
}
114114

115115
/** @internal */
@@ -1304,8 +1304,7 @@ const AnnotationsReducer: Cause.CauseReducer<Context.Context<never>, unknown, Ca
13041304
emptyCase: (_) => empty,
13051305
failCase: (context, error, annotations) => fail(addOriginalAnnotations(error, Context.merge(context, annotations))),
13061306
dieCase: (context, defect, annotations) => die(addOriginalAnnotations(defect, Context.merge(context, annotations))),
1307-
interruptCase: (context, fiberId, annotations) =>
1308-
interrupt(addOriginalAnnotations(fiberId, Context.merge(context, annotations))),
1307+
interruptCase: (_, fiberId) => interrupt(fiberId),
13091308
sequentialCase: (_, left, right) => sequential(left, right),
13101309
parallelCase: (_, left, right) => parallel(left, right),
13111310
annotatedCase: (context, cause, annotations) => annotated(cause, Context.merge(context, annotations))

packages/effect/src/internal/fiberRuntime.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,18 @@ export class FiberRuntime<in out A, in out E = never> extends Effectable.Class<A
493493
*/
494494
interruptAsFork(fiberId: FiberId.FiberId): Effect.Effect<void> {
495495
return core.withFiberRuntime<void>((fiber) => {
496-
const span = fiber.currentSpan
497-
if (span && span._tag === "Span") {
498-
fiberId = internalCause.addOriginalAnnotation(fiberId, internalCause.InterruptorSpan, span)
496+
let context = Context.empty()
497+
if (fiber.currentSpan && fiber.currentSpan._tag === "Span") {
498+
context = Context.add(context, internalCause.InterruptorSpan, fiber.currentSpan)
499499
}
500-
this.unsafeInterruptAsFork(fiberId)
500+
if (this.currentSpan && this.currentSpan._tag === "Span") {
501+
context = Context.add(context, internalCause.FailureSpan, this.currentSpan)
502+
}
503+
this.tell(FiberMessage.interruptSignal(
504+
Context.isEmpty(context)
505+
? internalCause.interrupt(fiberId)
506+
: internalCause.annotated(internalCause.interrupt(fiberId), context)
507+
))
501508
return core.void
502509
})
503510
}

0 commit comments

Comments
 (0)