Add OnStopped method to dispose of _linkedTokenSource

This commit introduces the OnStopped method in the WorkflowInstanceImpl class to properly dispose of _linkedTokenSource. This change ensures that resources are appropriately cleaned up when the actor is stopped, preventing potential memory leaks.
This commit is contained in:
Sipke Schoorstra 2024-07-24 14:14:50 +02:00
parent 95476cac99
commit 3b304c8e08

View file

@ -47,6 +47,12 @@ internal class WorkflowInstanceImpl(
return Task.CompletedTask;
}
public override Task OnStopped()
{
_linkedTokenSource.Dispose();
return Task.CompletedTask;
}
public override Task<ProtoCreateWorkflowInstanceResponse> Create(ProtoCreateWorkflowInstanceRequest request) => throw new NotImplementedException();
public override Task Create(ProtoCreateWorkflowInstanceRequest request, Action<ProtoCreateWorkflowInstanceResponse> respond, Action<string> onError)