Remove broken stopwatch logic

Fixes #956
This commit is contained in:
Sipke Schoorstra 2021-05-10 17:06:44 +02:00
parent e6171ecaa0
commit 6889b0cf38

View file

@ -10,7 +10,6 @@ namespace Elsa.Handlers
public class LogWorkflowExecution : INotificationHandler<ActivityExecuting>, INotificationHandler<ActivityExecuted>, INotificationHandler<WorkflowExecutionBurstCompleted>, INotificationHandler<ActivityFaulted>
{
private readonly ILogger _logger;
private readonly Stopwatch _stopwatch = new();
public LogWorkflowExecution(ILogger<LogWorkflowExecution> logger)
{
@ -19,7 +18,6 @@ namespace Elsa.Handlers
public Task Handle(ActivityExecuting notification, CancellationToken cancellationToken)
{
_stopwatch.Start();
var activityBlueprint = notification.Activity;
var activityId = activityBlueprint.Id;
var workflowInstanceId = notification.WorkflowExecutionContext.WorkflowInstance.Id;
@ -29,11 +27,10 @@ namespace Elsa.Handlers
public Task Handle(ActivityExecuted notification, CancellationToken cancellationToken)
{
_stopwatch.Stop();
var activityBlueprint = notification.Activity;
var activityId = activityBlueprint.Id;
var workflowInstanceId = notification.WorkflowExecutionContext.WorkflowInstance.Id;
_logger.LogDebug("Executed activity {ActivityType} {ActivityId} for workflow {WorkflowInstanceId} in {ElapsedTime}", activityBlueprint.Type, activityId, workflowInstanceId, _stopwatch.Elapsed);
_logger.LogDebug("Executed activity {ActivityType} {ActivityId} for workflow {WorkflowInstanceId}", activityBlueprint.Type, activityId, workflowInstanceId);
return Task.CompletedTask;
}