Skip to content

Commit d5428a3

Browse files
committed
skip interceptors for future internal updates/signals
1 parent 3a8683a commit d5428a3

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/workflow/src/internals.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,13 @@ export class Activator implements ActivationHandler {
724724
throw new TypeError(`Cannot use update name: '${name}', with reserved prefix: '${TEMPORAL_RESERVED_PREFIX}'`);
725725
}
726726

727+
// Skip interceptors if it's an internal update.
728+
const isInternalUpdate =
729+
queryType.startsWith(TEMPORAL_RESERVED_PREFIX) ||
730+
queryType === STACK_TRACE_RESERVED_NAME ||
731+
queryType === ENHANCED_STACK_TRACE_RESERVED_NAME;
732+
const interceptors = isInternalUpdate ? [] : this.interceptors.inbound;
733+
727734
const entry =
728735
this.updateHandlers.get(name) ??
729736
(this.defaultUpdateHandler
@@ -780,7 +787,7 @@ export class Activator implements ActivationHandler {
780787
try {
781788
if (runValidator && entry.validator) {
782789
const validate = composeInterceptors(
783-
this.interceptors.inbound,
790+
interceptors,
784791
'validateUpdate',
785792
this.validateUpdateNextHandler.bind(this, entry.validator)
786793
);
@@ -793,7 +800,7 @@ export class Activator implements ActivationHandler {
793800
}
794801
this.acceptUpdate(protocolInstanceId);
795802
const execute = composeInterceptors(
796-
this.interceptors.inbound,
803+
interceptors,
797804
'handleUpdate',
798805
this.updateNextHandler.bind(this, entry.handler)
799806
);
@@ -883,6 +890,13 @@ export class Activator implements ActivationHandler {
883890
);
884891
}
885892

893+
// Skip interceptors if it's an internal signal.
894+
const isInternalSignal =
895+
queryType.startsWith(TEMPORAL_RESERVED_PREFIX) ||
896+
queryType === STACK_TRACE_RESERVED_NAME ||
897+
queryType === ENHANCED_STACK_TRACE_RESERVED_NAME;
898+
const interceptors = isInternalSignal ? [] : this.interceptors.inbound;
899+
886900
if (!this.signalHandlers.has(signalName) && !this.defaultSignalHandler) {
887901
this.bufferedSignals.push(activation);
888902
return;
@@ -897,7 +911,7 @@ export class Activator implements ActivationHandler {
897911
const signalExecutionNum = this.signalHandlerExecutionSeq++;
898912
this.inProgressSignals.set(signalExecutionNum, { name: signalName, unfinishedPolicy });
899913
const execute = composeInterceptors(
900-
this.interceptors.inbound,
914+
interceptors,
901915
'handleSignal',
902916
this.signalWorkflowNextHandler.bind(this)
903917
);

0 commit comments

Comments
 (0)