akka / akka/akka-http

Add onRequestTimeout Directive

Open
#2,015 3 comments 0 reactions 0 assignees View on GitHub
1 - triaged help wanted t:routing
Dominant language
Scala
Stars
1.4k
Forks
584
Avg merge
14h 33m
Merged PRs (30d)
24

Description

It would be nice if we had a directive that allowed us to side-effect when a server request timeout occurs. Currently we can do something on `withRequestTimeoutResponse`, but that requires us to supply a response rather than let the timeout handling happen elsewhere.
An example of when this is desirable would be when an external request results in client requests or other streams being run that need to be consumed to supply a response to the request. In this case it's desirable to consume/killswitch those streams when the request times out.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing `withRequestTimeoutResponse` directive and related request-timeout handling in the Akka HTTP server API. Define how an `onRequestTimeout` directive should trigger side effects while leaving timeout response handling elsewhere, including cancellation or consumption of streams; done means the directive behaves correctly for the described external-request scenario and is covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.