RequestTimeout class
Answers 503 Service Unavailable when the rest of the middleware
and the controller take longer than duration.
Route.get('report', <dynamic>[
RequestTimeout(Duration(seconds: 30)),
reportController.show,
]);
Route.get('report', reportController.show).timeout(Duration(seconds: 30));
For every route, add it to globalMiddleware. The error is a normal
HttpStatusException(503) with the code request_timeout, so the
ExceptionHandler renders it, and reports it like every 5xx.
Dart can not stop a running Future. The controller keeps running in
the background, and its late result is dropped. It can not write to
the answer any more. AfterResponse work may run while it still
runs. The upload temp files stay until it ends.
- Implemented types
Constructors
- RequestTimeout(Duration duration)
-
const
Properties
Methods
-
handle(
DoxRequest req, Next next) → Future< DoxResponse> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited