pjfanning opened a new pull request, #922:
URL: https://github.com/apache/pekko-grpc/pull/922

   ### Motivation
   A deadline could only be set for all calls of a client, through 
`GrpcClientSettings.withDeadline` or the `deadline` setting.
   
   ### Modification
   Port of akka/akka-grpc#1838 (Akka gRPC 2.4.0, Apache 2.0 since its change 
date, 2026-10-24). It adds `setDeadline` to the scaladsl and javadsl 
`SingleResponseRequestBuilder` and `StreamResponseRequestBuilder`, so a 
deadline can be set for a single call:
   
   ```scala
   client.sayHello().setDeadline(200.millis).invoke(request)
   ```
   
   Unlike upstream, this works the same way on both backends:
   - `setDeadline` replaces the builder's client-settings deadline. Upstream 
sets a deadline on the builder's `CallOptions`, which starts counting when 
`setDeadline` is called, so a builder reused later already has an expired 
deadline. Here the deadline is counted from when the call is invoked, as the 
client settings deadline already was.
   - The request builders now apply the deadline on every call path. Before, 
unary `invoke` passed the bare options, so the pekko-http backend ignored the 
client deadline for it.
   - The Netty channel no longer re-applies the client settings deadline over 
the options it is given. Upstream does, so the client deadline overrides a 
per-call deadline on Netty whenever both are set.
   - `Duration.Inf` (Scala) or `null` (Java) means no deadline for that call.
   - MiMa excludes for the new methods on the `@DoNotInherit` traits 
(`ReversedMissingMethodProblem`), as upstream has.
   - A new "Deadlines" section in `client/details.md`, with Scala and Java 
snippets.
   
   ### Result
   A deadline can be set for a single call. It overrides the client deadline, 
with the same behaviour on the netty and pekko-http backends.
   
   ### Tests
   - New `PerCallDeadlineSpec`, run with both the netty and the pekko-http 
backend. It covers unary `invoke` and `invokeWithMetadata`, server streaming, 
overriding the client deadline, and starting the deadline at invoke time. New 
`PerCallDeadlineTest` covers the javadsl on both backends. Upstream adds no 
tests.
   - Without this change the new tests don't compile (there is no 
`setDeadline`). With upstream's approach in place (deadline on `CallOptions`, 
Netty channel re-applying the client deadline), "override the deadline of the 
client settings" and "start when the call is invoked rather than when it is 
set" fail. Both pass with this change.
   - `sbt runtime/test`: 189 passed
   - `sbt interop-tests/test`: 264 passed
   - `sbt runtime/mimaReportBinaryIssues`: passed
   - `sbt headerCheckAll`, `sbt interop-tests/Test/javafmt` (JDK 17), `sbt 
docs/paradox`: passed
   - `scalafmt --mode diff-ref=upstream/main` run
   
   ### References
   Refs akka/akka-grpc#1838
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to