-
SummaryI want to release some resource when the response finished. axum version0.8.3 |
Beta Was this translation helpful? Give feedback.
Answered by
jplatte
Apr 26, 2025
Replies: 1 comment 3 replies
-
Can you please be a bit more specific? The solution probably involves writing a custom implementation of |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay, so you want to limit the number of concurrent requests to a specific route that your service allows? Where are these
apply_permit()
/back_permit()
methods coming from? The fact that the former is not async suggest that thislimit_pool
is not something you should be using in an async context.This is application code, right? You could probably implement
http_body::Body
for a wrapper type that delegates all the methods to the inner type (using pin projection), and use Pinned Drop to give back the permit. Would have to spawn a tokio task for that last bit, if it can't be made non-async.If that's all still too abstract, I can try to find some time to write up a code snippet.