@@ -118,7 +118,9 @@ export type ActivityTaskWithBase64Token = {
118
118
base64TaskToken : string ;
119
119
} ;
120
120
121
- type CompiledWorkerOptionsWithBuildId = CompiledWorkerOptions & { buildId : string } ;
121
+ type CompiledWorkerOptionsWithBuildId = CompiledWorkerOptions & {
122
+ buildId : string ;
123
+ } ;
122
124
123
125
/**
124
126
* Combined error information for {@link Worker.runUntil}
@@ -208,7 +210,10 @@ export class NativeWorker implements NativeWorkerLike {
208
210
public static async createReplay ( options : CompiledWorkerOptionsWithBuildId ) : Promise < NativeReplayHandle > {
209
211
const runtime = Runtime . instance ( ) ;
210
212
const replayer = await runtime . createReplayWorker ( options ) ;
211
- return { worker : new NativeWorker ( runtime , replayer . worker ) , historyPusher : replayer . pusher } ;
213
+ return {
214
+ worker : new NativeWorker ( runtime , replayer . worker ) ,
215
+ historyPusher : replayer . pusher ,
216
+ } ;
212
217
}
213
218
214
219
protected constructor ( protected readonly runtime : Runtime , protected readonly nativeWorker : native . Worker ) {
@@ -461,6 +466,7 @@ export class Worker {
461
466
// This isn't required for vscode, only for Chrome Dev Tools which doesn't support debugging worker threads.
462
467
// We also rely on this in debug-replayer where we inject a global variable to be read from workflow context.
463
468
if ( compiledOptions . debugMode ) {
469
+ // eslint-disable-next-line deprecation/deprecation
464
470
if ( compiledOptions . reuseV8Context ) {
465
471
return await ReusableVMWorkflowCreator . create (
466
472
workflowBundle ,
@@ -478,7 +484,8 @@ export class Worker {
478
484
workflowBundle,
479
485
threadPoolSize : compiledOptions . workflowThreadPoolSize ,
480
486
isolateExecutionTimeoutMs : compiledOptions . isolateExecutionTimeoutMs ,
481
- reuseV8Context : compiledOptions . reuseV8Context ?? false ,
487
+ // eslint-disable-next-line deprecation/deprecation
488
+ reuseV8Context : compiledOptions . reuseV8Context ?? true ,
482
489
registeredActivityNames,
483
490
} ) ;
484
491
}
@@ -828,7 +835,11 @@ export class Worker {
828
835
type : 'result' ;
829
836
result : coresdk . activity_result . IActivityExecutionResult ;
830
837
}
831
- | { type : 'run' ; activity : Activity ; input : ActivityExecuteInput }
838
+ | {
839
+ type : 'run' ;
840
+ activity : Activity ;
841
+ input : ActivityExecuteInput ;
842
+ }
832
843
| { type : 'ignore' } ;
833
844
switch ( variant ) {
834
845
case 'start' : {
@@ -854,7 +865,10 @@ export class Worker {
854
865
message : `Activity function ${ activityType } is not registered on this Worker, available activities: ${ JSON . stringify (
855
866
Object . keys ( this . options . activities ?? { } )
856
867
) } `,
857
- applicationFailureInfo : { type : 'NotFoundError' , nonRetryable : false } ,
868
+ applicationFailureInfo : {
869
+ type : 'NotFoundError' ,
870
+ nonRetryable : false ,
871
+ } ,
858
872
} ,
859
873
} ,
860
874
} ,
@@ -912,7 +926,9 @@ export class Worker {
912
926
case 'cancel' : {
913
927
output = { type : 'ignore' } ;
914
928
if ( activity === undefined ) {
915
- this . log . error ( 'Tried to cancel a non-existing activity' , { taskToken : base64TaskToken } ) ;
929
+ this . log . error ( 'Tried to cancel a non-existing activity' , {
930
+ taskToken : base64TaskToken ,
931
+ } ) ;
916
932
break ;
917
933
}
918
934
// NOTE: activity will not be considered cancelled until it confirms cancellation (by throwing a CancelledFailure)
@@ -1013,15 +1029,24 @@ export class Worker {
1013
1029
// Core has indicated that it will not return any more poll results, evict all cached WFs
1014
1030
filter ( ( state ) => state !== 'POLLING' ) ,
1015
1031
first ( ) ,
1016
- map ( ( ) : { activation : coresdk . workflow_activation . WorkflowActivation ; synthetic : true } => {
1017
- return {
1018
- activation : coresdk . workflow_activation . WorkflowActivation . create ( {
1019
- runId : group$ . key ,
1020
- jobs : [ { removeFromCache : Worker . SELF_INDUCED_SHUTDOWN_EVICTION } ] ,
1021
- } ) ,
1022
- synthetic : true ,
1023
- } ;
1024
- } ) ,
1032
+ map (
1033
+ ( ) : {
1034
+ activation : coresdk . workflow_activation . WorkflowActivation ;
1035
+ synthetic : true ;
1036
+ } => {
1037
+ return {
1038
+ activation : coresdk . workflow_activation . WorkflowActivation . create ( {
1039
+ runId : group$ . key ,
1040
+ jobs : [
1041
+ {
1042
+ removeFromCache : Worker . SELF_INDUCED_SHUTDOWN_EVICTION ,
1043
+ } ,
1044
+ ] ,
1045
+ } ) ,
1046
+ synthetic : true ,
1047
+ } ;
1048
+ }
1049
+ ) ,
1025
1050
takeUntil ( group$ . pipe ( last ( undefined , null ) ) )
1026
1051
)
1027
1052
) . pipe (
@@ -1227,7 +1252,10 @@ export class Worker {
1227
1252
} ) . finish ( ) ;
1228
1253
// We do not dispose of the Workflow yet, wait to be evicted from Core.
1229
1254
// This is done to simplify the Workflow lifecycle so Core is the sole driver.
1230
- return { state : undefined , output : { close : true , completion } } ;
1255
+ return {
1256
+ state : undefined ,
1257
+ output : { close : true , completion } ,
1258
+ } ;
1231
1259
}
1232
1260
} ,
1233
1261
undefined
@@ -1298,7 +1326,10 @@ export class Worker {
1298
1326
*/
1299
1327
protected activityHeartbeat$ ( ) : Observable < void > {
1300
1328
function process ( state : HeartbeatState , heartbeat : Heartbeat ) : HeartbeatStateAndOutput {
1301
- return { state : { ...state , processing : true , pending : undefined } , output : { type : 'send' , heartbeat } } ;
1329
+ return {
1330
+ state : { ...state , processing : true , pending : undefined } ,
1331
+ output : { type : 'send' , heartbeat } ,
1332
+ } ;
1302
1333
}
1303
1334
1304
1335
function storePending ( state : HeartbeatState , heartbeat : Heartbeat ) : HeartbeatStateAndOutput {
@@ -1307,7 +1338,12 @@ export class Worker {
1307
1338
1308
1339
function complete ( callback : ( ) => void ) : HeartbeatStateAndOutput {
1309
1340
return {
1310
- state : { pending : undefined , completionCallback : undefined , processing : false , closed : true } ,
1341
+ state : {
1342
+ pending : undefined ,
1343
+ completionCallback : undefined ,
1344
+ processing : false ,
1345
+ closed : true ,
1346
+ } ,
1311
1347
output : { type : 'close' , completionCallback : callback } ,
1312
1348
} ;
1313
1349
}
@@ -1325,7 +1361,10 @@ export class Worker {
1325
1361
( state : HeartbeatState , input : HeartbeatInput ) : HeartbeatStateAndOutput => {
1326
1362
if ( input . type === 'create' ) {
1327
1363
this . numHeartbeatingActivitiesSubject . next ( this . numHeartbeatingActivitiesSubject . value + 1 ) ;
1328
- return { state : { processing : false , closed : false } , output : null } ;
1364
+ return {
1365
+ state : { processing : false , closed : false } ,
1366
+ output : null ,
1367
+ } ;
1329
1368
}
1330
1369
// Ignore any input if we've marked this activity heartbeat stream as closed
1331
1370
// (rogue heartbeat)
@@ -1350,7 +1389,10 @@ export class Worker {
1350
1389
return complete ( state . completionCallback ) ;
1351
1390
} else {
1352
1391
// Nothing to do, wait for completion or heartbeat
1353
- return { state : { ...state , processing : false } , output : null } ;
1392
+ return {
1393
+ state : { ...state , processing : false } ,
1394
+ output : null ,
1395
+ } ;
1354
1396
}
1355
1397
case 'completion' :
1356
1398
if ( state . processing ) {
@@ -1409,7 +1451,10 @@ export class Worker {
1409
1451
} ) . finish ( ) ;
1410
1452
this . nativeWorker . recordActivityHeartbeat ( byteArrayToBuffer ( arr ) ) ;
1411
1453
} finally {
1412
- this . activityHeartbeatSubject . next ( { type : 'flush' , base64TaskToken } ) ;
1454
+ this . activityHeartbeatSubject . next ( {
1455
+ type : 'flush' ,
1456
+ base64TaskToken,
1457
+ } ) ;
1413
1458
}
1414
1459
} ) ,
1415
1460
tap ( { complete : group$ . close } )
@@ -1484,7 +1529,10 @@ export class Worker {
1484
1529
const task = coresdk . activity_task . ActivityTask . decode ( new Uint8Array ( buffer ) ) ;
1485
1530
const { taskToken, ...rest } = task ;
1486
1531
const base64TaskToken = formatTaskToken ( taskToken ) ;
1487
- this . log . trace ( 'Got activity task' , { taskToken : base64TaskToken , ...rest } ) ;
1532
+ this . log . trace ( 'Got activity task' , {
1533
+ taskToken : base64TaskToken ,
1534
+ ...rest ,
1535
+ } ) ;
1488
1536
const { variant } = task ;
1489
1537
if ( variant === undefined ) {
1490
1538
throw new TypeError ( 'Got an activity task without a "variant" attribute' ) ;
0 commit comments