private async Task ReleaseTokensAsync(IEnumerable <Token> result) { var listReleaseTasks = new List <Task>(); foreach (var item in result) { listReleaseTasks.Add(Task.Run(() => _tokenService.Release(MyClientName, item.Id))); } await Task.WhenAll(listReleaseTasks).ConfigureAwait(false); Console.WriteLine($"Released tokens..."); }
public override Task <ReleaseTokenReply> Release(ReleaseTokenRequest request, ServerCallContext context) { try { _tokenGen.Release(request.Clientid, request.Tokenid); //Console.WriteLine($"Release token for Client: {request.Clientid} TokenId:{request.Tokenid}"); _logger?.LogInformation($"Release token for Client: {request.Clientid} TokenId:{request.Tokenid}"); return(Task.FromResult(new ReleaseTokenReply())); } catch (Exception ex) { _logger?.LogError(ex, $"Exception releasing token for client:{request.Clientid}, token:{request.Tokenid}"); throw; } }