Skip to content

Commit

Permalink
Merge pull request #6218 from SergerGood/main
Browse files Browse the repository at this point in the history
Call async methods when in an async method
  • Loading branch information
sfmskywalker authored Dec 22, 2024
2 parents e39f671 + 8583da9 commit 621c298
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task<T> WaitAsync<T>(object signal, int millisecondsTimeout = 60000
await Task.WhenAny(taskCompletionSource.Task, Task.Delay(millisecondsTimeout, cancellationTokenSource.Token));
cancellationTokenSource.Token.ThrowIfCancellationRequested();
_signals.TryRemove(signal, out _);
return taskCompletionSource.Task.Result;
return await taskCompletionSource.Task;
}
catch (OperationCanceledException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public override void Configure()

public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)
{
var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public override void Configure()

public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)
{
var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public override void Configure()

public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)
{
var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public override void Configure()

public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)
{
var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public override async Task HandleAsync(Request request, CancellationToken cancel
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public override void Configure()

public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
{
var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public override async Task HandleAsync(WorkflowDefinitionModel model, Cancellati
var result = await ImportSingleWorkflowDefinitionAsync(model, cancellationToken);
var definition = result.WorkflowDefinition;

var authorizationResult = _authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await _authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public override void Configure()
/// <inheritdoc />
public override async Task HandleAsync(WorkflowDefinitionModel model, CancellationToken cancellationToken)
{
var authorizationResult = _authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await _authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public override async Task HandleAsync(SaveWorkflowDefinitionRequest request, Ca
draft.DefinitionId = definitionId;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(draft), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(draft), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public override async Task HandleAsync(Request request, CancellationToken cancel
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public override async Task HandleAsync(Request request, CancellationToken cancel
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public override async Task HandleAsync(Request request, CancellationToken cancel
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public override async Task HandleAsync(CancellationToken cancellationToken)
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public override async Task HandleAsync(CancellationToken cancellationToken)
return;
}

var authorizationResult = authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);
var authorizationResult = await authorizationService.AuthorizeAsync(User, new NotReadOnlyResource(definition), AuthorizationPolicies.NotReadOnlyPolicy);

if (!authorizationResult.Result.Succeeded)
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
return;
Expand Down

0 comments on commit 621c298

Please sign in to comment.