Skip to content

Commit

Permalink
Merge pull request #81 from marcwittke/hotfix/5.1.13
Browse files Browse the repository at this point in the history
InvokeAsync fixed
  • Loading branch information
marcwittke committed Aug 23, 2019
2 parents 1a3177a + a6d4c70 commit 8f7e967
Showing 1 changed file with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,9 @@ public void Invoke(Action action, IIdentity identity, TenantId tenantId)
}
}

public async Task InvokeAsync(Action action, IIdentity identity, TenantId tenantId, CancellationToken cancellationToken = default)
public async Task InvokeAsync(Action action, IIdentity identity, TenantId tenantId, CancellationToken cancellationToken)
{
using (BeginScope(new SystemIdentity(), tenantId))
{
using (var unitOfWork = CompositionRoot.GetInstance<IUnitOfWork>())
{
try
{
unitOfWork.Begin();
await Task.Factory.StartNew(action, cancellationToken);
unitOfWork.Complete();
}
catch (TargetInvocationException ex)
{
ExceptionLogger.LogException(ex.InnerException ?? ex);
}
catch (Exception ex)
{
Logger.Info(ex);
ExceptionLogger.LogException(ex);
}
}
}
await Task.Factory.StartNew(() => Invoke(action, identity, tenantId), cancellationToken);
}

/// <summary>
Expand Down

0 comments on commit 8f7e967

Please sign in to comment.