-
Notifications
You must be signed in to change notification settings - Fork 558
Description
I am writing a synchronous computational library (which does not use rayon by itself), with an option to have HTTP interface on top of it. HTTP interface uses axum
/tokio
, but as soon as there is any CPU-heavy request to handle, it spawns a rayon task (using tokio-rayon
crate so far, as far as I understood from #679, there is no built-in functionality for that so far).
The load depends on what comes in a request, and it's hard to predict by just looking at arguments. My HTTP server is configured with tower
timeouts, so that too heavy tasks are killed.
The issue is, so far all i can do in an error handler is to return HTTP error code, while rayon will keep processing it, sometimes until the bitter kill signal. Are there workarounds, which do not involve me spamming my library with channel arguments throughout all its functions, and adding checkpoints where the lib checks for messages and decide if it should stop processing and return an error?