/// <summary> /// Compact compacts the event history in the etcd key-value store in async. The key-value /// store should be periodically compacted or the event history will continue to grow /// indefinitely. /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Metadata headers = null) { CompactionResponse response = new CompactionResponse(); bool success = false; int retryCount = 0; while (!success) { try { response = await _balancer.GetConnection().kvClient.CompactAsync(request, headers); success = true; } catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable) { retryCount++; if (retryCount >= _balancer._numNodes) { throw ex; } } } return(response); }
/// <summary> /// Compact compacts the event history in the etcd key-value store in async. The key-value /// store should be periodically compacted or the event history will continue to grow /// indefinitely. /// </summary> /// <param name="request">The request to send to the server.</param> /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> /// <param name="cancellationToken">An optional token for canceling the call.</param> /// <returns>The response received from the server.</returns> public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Grpc.Core.Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default) { CompactionResponse response = new CompactionResponse(); bool success = false; int retryCount = 0; while (!success) { try { response = await _balancer.GetConnection().kvClient .CompactAsync(request, headers, deadline, cancellationToken); success = true; } catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable) { retryCount++; if (retryCount >= _balancer._numNodes) { throw; } } } return(response); }