Provide a way to check a request is timed out before executing a blocking task
See original GitHub issueSome users want to reject to run a blocking task after a request was timed out.
It seems useful to add an option that fails fast when a request was timed out when building a Server
class ServerBuilder {
public ServerBuilder blockingTaskExecutor(int numThreads, boolean allowExecutingAfterTimeout) {
if (!allowExecutingAfterTimeout) {
BlockingTaskExecutor executor =
BlockingTaskExecutor.builder()
.numThreads(numThreads)
.taskFunction(task -> {
return () -> {
ServiceRequestContext ctx = ServiceRequestContext.currentOrNull();
if (ctx == null || !ctx.isTimedOut()) {
task.run();
}
};
})
.build();
} else {
...
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Receiving "The request timed out." when using NSURLSession
I'm facing a very strange problem in my application. In particular, using the application when a request receives a timeout message, all the...
Read more >Asynchronously wait for Task<T> to complete with timeout
I can use Task. Wait to synchronously wait for the task to complete with a timeout, but that blocks my thread.
Read more >Troubleshoot query time-out errors - SQL Server
This article describes how to troubleshoot the time-out errors when you run slow-running queries.
Read more >Handling long Web Requests with Asynchronous Request ...
Long requests can time out the Web server Web servers are set up with certain timeouts to kill connections after the timeout period...
Read more >Troubleshoot Lambda function invocation timeout errors
Retrieve the request IDs of any timed-out invocations by searching the function's Amazon CloudWatch log group for the phrase, Task timed out ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Let me try it 😄 @ikhoon nim.
Had a chat with @minwoox and he was concerned that a resource could be leaked if a
close()method that should be called is not executed in the task job whentaskFunctionis used. Alternately, we can wrap a blocking task executor with a decorator.But I wasn’t sure that this is a good first issue. Because we need to check overall implementations that use
BlockingTaskExecutorin Armeria. Why don’t you pick up another issue? 😅