Skip to content

Commit 8cfd33e

Browse files
fix: delete default timeout grpc.deadline (#227)
* fix: delete default timeout grpc.deadline * Update CHANGELOG.md * Refactoring publish.sh
1 parent 30c0e1f commit 8cfd33e

File tree

6 files changed

+12
-28
lines changed

6 files changed

+12
-28
lines changed

.github/scripts/publish.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ LAST_TAG=$(git tag | tail -n 1);
1212
MAJOR=$(echo $LAST_TAG | sed -E 's/v([0-9]+)\..*/\1/');
1313
MINOR=$(echo $LAST_TAG | sed -E 's/v[0-9]+\.([0-9]+)\..*/\1/');
1414
PATCH=$(echo $LAST_TAG | sed -E 's/v[0-9]+\.[0-9]+\.([0-9]+)-rc[0-9]+/\1/');
15-
RC=0;
15+
RC=$(git tag | grep "v$MAJOR.$MINOR.$PATCH-rc" | wc -l | xargs || true);
1616

17-
if [ "$RELEASE_CANDIDATE" = true ]
18-
then
19-
RC=$(git tag | grep "v$MAJOR.$MINOR.$PATCH-rc" | wc -l | xargs || true);
20-
fi
2117
if [ "$VERSION_CHANGE" = "MINOR" ] && [ $RC = 0 ]
2218
then
2319
MINOR=$((MINOR+1));

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- Writer client for YDB topics
2+
- Fix: delete default timeout grpc.deadline
3+
14
## v0.9.0-rc1
25
- Topic Writer updated release candidate:
36
* Do not send messages that have a timeout by cancelToken.

src/Ydb.Sdk/src/Driver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private async Task<Status> DiscoverEndpoints()
123123
TransportTimeout = Config.EndpointDiscoveryTimeout
124124
};
125125

126-
var options = GetCallOptions(requestSettings, false);
126+
var options = GetCallOptions(requestSettings);
127127
options.Headers.Add(Metadata.RpcSdkInfoHeader, _sdkInfo);
128128

129129
var response = await client.ListEndpointsAsync(

src/Ydb.Sdk/src/DriverConfig.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ public class DriverConfig
99
public string Database { get; }
1010
public ICredentialsProvider Credentials { get; }
1111
public X509Certificate? CustomServerCertificate { get; }
12-
public TimeSpan DefaultTransportTimeout { get; }
13-
public TimeSpan DefaultStreamingTransportTimeout { get; }
1412

1513
internal TimeSpan EndpointDiscoveryInterval = TimeSpan.FromMinutes(1);
1614
internal TimeSpan EndpointDiscoveryTimeout = TimeSpan.FromSeconds(10);
@@ -19,15 +17,11 @@ public DriverConfig(
1917
string endpoint,
2018
string database,
2119
ICredentialsProvider? credentials = null,
22-
TimeSpan? defaultTransportTimeout = null,
23-
TimeSpan? defaultStreamingTransportTimeout = null,
2420
X509Certificate? customServerCertificate = null)
2521
{
2622
Endpoint = FormatEndpoint(endpoint);
2723
Database = database;
2824
Credentials = credentials ?? new AnonymousProvider();
29-
DefaultTransportTimeout = defaultTransportTimeout ?? TimeSpan.FromMinutes(1);
30-
DefaultStreamingTransportTimeout = defaultStreamingTransportTimeout ?? TimeSpan.FromMinutes(10);
3125
CustomServerCertificate = customServerCertificate;
3226
}
3327

src/Ydb.Sdk/src/GrpcRequestSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class GrpcRequestSettings
99
internal static readonly GrpcRequestSettings DefaultInstance = new();
1010

1111
public string TraceId { get; set; } = string.Empty;
12-
public TimeSpan? TransportTimeout { get; set; }
12+
public TimeSpan TransportTimeout { get; set; } = TimeSpan.Zero;
1313
public ImmutableArray<string> CustomClientHeaders { get; } = new();
1414

1515
internal long NodeId { get; set; }

src/Ydb.Sdk/src/IDriver.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task<TResponse> UnaryCall<TRequest, TResponse>(
6969
using var call = callInvoker.AsyncUnaryCall(
7070
method: method,
7171
host: null,
72-
options: GetCallOptions(settings, false),
72+
options: GetCallOptions(settings),
7373
request: request
7474
);
7575

@@ -98,7 +98,7 @@ public ServerStream<TResponse> ServerStreamCall<TRequest, TResponse>(
9898
var call = callInvoker.AsyncServerStreamingCall(
9999
method: method,
100100
host: null,
101-
options: GetCallOptions(settings, true),
101+
options: GetCallOptions(settings),
102102
request: request);
103103

104104
return new ServerStream<TResponse>(call, e => { OnRpcError(endpoint, e); });
@@ -116,7 +116,7 @@ public IBidirectionalStream<TRequest, TResponse> BidirectionalStreamCall<TReques
116116
var call = callInvoker.AsyncDuplexStreamingCall(
117117
method: method,
118118
host: null,
119-
options: GetCallOptions(settings, true));
119+
options: GetCallOptions(settings));
120120

121121
return new BidirectionalStream<TRequest, TResponse>(call, e => { OnRpcError(endpoint, e); });
122122
}
@@ -125,7 +125,7 @@ public IBidirectionalStream<TRequest, TResponse> BidirectionalStreamCall<TReques
125125

126126
protected abstract void OnRpcError(string endpoint, RpcException e);
127127

128-
protected CallOptions GetCallOptions(GrpcRequestSettings settings, bool streaming)
128+
protected CallOptions GetCallOptions(GrpcRequestSettings settings)
129129
{
130130
var meta = new Grpc.Core.Metadata
131131
{
@@ -143,22 +143,13 @@ protected CallOptions GetCallOptions(GrpcRequestSettings settings, bool streamin
143143
meta.Add(Metadata.RpcTraceIdHeader, settings.TraceId);
144144
}
145145

146-
var transportTimeout = streaming
147-
? Config.DefaultStreamingTransportTimeout
148-
: Config.DefaultTransportTimeout;
149-
150-
if (settings.TransportTimeout != null)
151-
{
152-
transportTimeout = settings.TransportTimeout.Value;
153-
}
154-
155146
var options = new CallOptions(
156147
headers: meta
157148
);
158149

159-
if (transportTimeout != TimeSpan.Zero)
150+
if (settings.TransportTimeout != TimeSpan.Zero)
160151
{
161-
options = options.WithDeadline(DateTime.UtcNow + transportTimeout);
152+
options = options.WithDeadline(DateTime.UtcNow + settings.TransportTimeout);
162153
}
163154

164155
return options;

0 commit comments

Comments
 (0)