diff --git a/.github/workflows/signoffs.yml b/.github/workflows/signoffs.yml index 6e0d14ea4..e6e5db74d 100644 --- a/.github/workflows/signoffs.yml +++ b/.github/workflows/signoffs.yml @@ -16,7 +16,7 @@ jobs: if: github.event_name == 'pull_request' run: | for commit in $(git rev-list "origin/${{ github.base_ref }}".."${{ github.event.pull_request.head.sha }}"); do - if ! git verify-commit --raw $commit 2>&1 | grep -q SIG; then + if ! git verify-commit --raw $commit 2>&1 | grep -iq SIG; then echo "--------------------------------------------------------------" echo "Error: Commit $commit is not signed using GPG, SSH, or S/MIME" echo "https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits" diff --git a/src/NATS.Client.JetStream/NatsJSContext.cs b/src/NATS.Client.JetStream/NatsJSContext.cs index dbb4eddef..30f8004d5 100644 --- a/src/NATS.Client.JetStream/NatsJSContext.cs +++ b/src/NATS.Client.JetStream/NatsJSContext.cs @@ -181,7 +181,7 @@ public async ValueTask> TryPublishAsync( requestSerializer: serializer, replySerializer: NatsJSJsonSerializer.Default, requestOpts: opts, - replyOpts: new NatsSubOpts { Timeout = Connection.Opts.RequestTimeout }, + replyOpts: new NatsSubOpts { Timeout = Opts.RequestTimeout }, cancellationToken).ConfigureAwait(false); } catch (NatsNoReplyException) @@ -223,7 +223,7 @@ public async ValueTask> TryPublishAsync( // is a reconnect to the cluster between the request and waiting for a response, // without the timeout the publish call will hang forever since the server // which received the request won't be there to respond anymore. - Timeout = Connection.Opts.RequestTimeout, + Timeout = Opts.RequestTimeout, }, cancellationToken) .ConfigureAwait(false); @@ -314,7 +314,7 @@ public async ValueTask PublishConcurrentAsync( // is a reconnect to the cluster between the request and waiting for a response, // without the timeout the publish call will hang forever since the server // which received the request won't be there to respond anymore. - Timeout = Connection.Opts.RequestTimeout, + Timeout = Opts.RequestTimeout, // If JetStream is disabled, a no responders error will be returned // No responders error might also happen when reconnecting to cluster @@ -403,7 +403,7 @@ internal async ValueTask>> TryJSRequestAsyn subject: subject, data: request, headers: null, - replyOpts: new NatsSubOpts { Timeout = Connection.Opts.RequestTimeout }, + replyOpts: new NatsSubOpts { Timeout = Opts.RequestTimeout }, requestSerializer: NatsJSJsonSerializer.Default, replySerializer: NatsJSJsonDocumentSerializer.Default, cancellationToken: cancellationToken).ConfigureAwait(false); @@ -444,7 +444,7 @@ internal async ValueTask>> TryJSRequestAsyn subject: subject, data: request, headers: default, - replyOpts: new NatsSubOpts { Timeout = Connection.Opts.RequestTimeout }, + replyOpts: new NatsSubOpts { Timeout = Opts.RequestTimeout }, requestSerializer: NatsJSJsonSerializer.Default, replySerializer: NatsJSJsonDocumentSerializer.Default, cancellationToken: cancellationToken) diff --git a/src/NATS.Client.JetStream/NatsJSOpts.cs b/src/NATS.Client.JetStream/NatsJSOpts.cs index cf8995f58..0611e2c3d 100644 --- a/src/NATS.Client.JetStream/NatsJSOpts.cs +++ b/src/NATS.Client.JetStream/NatsJSOpts.cs @@ -8,7 +8,7 @@ namespace NATS.Client.JetStream; /// public record NatsJSOpts { - public NatsJSOpts(NatsOpts opts, string? apiPrefix = default, string? domain = default, AckOpts? ackOpts = default) + public NatsJSOpts(NatsOpts opts, string? apiPrefix = default, string? domain = default, AckOpts? ackOpts = default, TimeSpan? requestTimeout = default) { if (apiPrefix != null && domain != null) { @@ -17,6 +17,7 @@ public NatsJSOpts(NatsOpts opts, string? apiPrefix = default, string? domain = d ApiPrefix = apiPrefix ?? "$JS.API"; Domain = domain; + RequestTimeout = requestTimeout ?? opts.RequestTimeout; } /// @@ -34,6 +35,11 @@ public NatsJSOpts(NatsOpts opts, string? apiPrefix = default, string? domain = d /// public string? Domain { get; } + /// + /// Timeout for JetStream API calls. + /// + public TimeSpan RequestTimeout { get; } + /// /// Ask server for an acknowledgment. ///