@@ -434,6 +434,8 @@ export class Activator implements ActivationHandler {
434434
435435 private readonly knownFlags = new Set < number > ( ) ;
436436
437+ sdkVersion ?: string ;
438+
437439 /**
438440 * Buffered sink calls per activation
439441 */
@@ -978,7 +980,22 @@ export class Activator implements ActivationHandler {
978980
979981 const signalExecutionNum = this . signalHandlerExecutionSeq ++ ;
980982 this . inProgressSignals . set ( signalExecutionNum , { name : signalName , unfinishedPolicy } ) ;
981- const execute = composeInterceptors ( interceptors , 'handleSignal' , this . signalWorkflowNextHandler . bind ( this ) ) ;
983+ const injectYield = shouldInjectYield ( this . sdkVersion ) ;
984+ const addedInterceptor : WorkflowInterceptors [ 'inbound' ] = injectYield
985+ ? [
986+ {
987+ handleSignal : async ( input , next ) => {
988+ await Promise . resolve ( ) ;
989+ return next ( input ) ;
990+ } ,
991+ } ,
992+ ]
993+ : [ ] ;
994+ const execute = composeInterceptors (
995+ [ ...addedInterceptor , ...interceptors ] ,
996+ 'handleSignal' ,
997+ this . signalWorkflowNextHandler . bind ( this )
998+ ) ;
982999 execute ( {
9831000 args : arrayFromPayloads ( this . payloadConverter , activation . input ) ,
9841001 signalName,
@@ -1305,3 +1322,23 @@ then you can disable this warning by passing an option when setting the handler:
13051322 Array . from ( names . entries ( ) ) . map ( ( [ name , count ] ) => ( { name, count } ) )
13061323 ) } `;
13071324}
1325+
1326+ function shouldInjectYield ( version ?: string ) : boolean {
1327+ if ( ! version ) {
1328+ return false ;
1329+ }
1330+ const [ major , minor , patch ] = version . split ( '.' ) ;
1331+ // 1.11.5 - 1.13.1: need to inject
1332+ if ( major !== '1' ) return false ;
1333+
1334+ switch ( minor ) {
1335+ case '11' :
1336+ return patch === '5' ;
1337+ case '12' :
1338+ return true ;
1339+ case '13' :
1340+ return patch === '1' ;
1341+ default :
1342+ return false ;
1343+ }
1344+ }
0 commit comments