File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,15 @@ export class ReusableVMWorkflowCreator implements WorkflowCreator {
210210 * Cleanup the pre-compiled script
211211 */
212212 public async destroy ( ) : Promise < void > {
213- // TODO: disable AsyncLocalStorage used for cancellation/update scopes
213+ if ( this . _context ) {
214+ vm . runInContext (
215+ `{
216+ __TEMPORAL__.api.destroy();
217+ }` ,
218+ this . _context ,
219+ { timeout : this . isolateExecutionTimeoutMs , displayErrors : true }
220+ ) ;
221+ }
214222 globalHandlers . removeWorkflowBundle ( this . workflowBundle ) ;
215223 delete this . _context ;
216224 }
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ export class VMWorkflowCreator implements WorkflowCreator {
126126export class VMWorkflow extends BaseVMWorkflow {
127127 public async dispose ( ) : Promise < void > {
128128 this . workflowModule . dispose ( ) ;
129+ this . workflowModule . destroy ( ) ;
129130 VMWorkflowCreator . workflowByRunId . delete ( this . runId ) ;
130131 delete this . context ;
131132 }
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import { WorkflowInterceptorsFactory } from './interceptors';
1010import { WorkflowCreateOptionsInternal } from './interfaces' ;
1111import { Activator } from './internals' ;
1212import { setActivatorUntyped , getActivator } from './global-attributes' ;
13+ import { disableStorage } from './cancellation-scope' ;
14+ import { disableUpdateStorage } from './update-scope' ;
1315
1416// Export the type for use on the "worker" side
1517export { PromiseStackStore } from './internals' ;
@@ -261,6 +263,11 @@ export function dispose(): void {
261263 }
262264}
263265
266+ export function destroy ( ) : void {
267+ disableStorage ( ) ;
268+ disableUpdateStorage ( ) ;
269+ }
270+
264271function isWorkflowFunctionWithOptions ( obj : any ) : obj is WorkflowFunctionWithOptions < any [ ] , any > {
265272 if ( obj == null ) return false ;
266273 return Object . hasOwn ( obj , 'workflowDefinitionOptions' ) ;
You can’t perform that action at this time.
0 commit comments