How can I get a function to run on every loop of axum? (Twilio-rs integration) #2002
matthiasdebernardini
started this conversation in
Ideas
Replies: 2 comments 7 replies
-
What do you mean by "on every nth loop that axum runs". Do you mean run something for every request? If so you need a middleware. See |
Beta Was this translation helpful? Give feedback.
2 replies
-
Actually, I think this is what I would need to implement. https://docs.rs/hyper/0.14.26/hyper/server/struct.Builder.html |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to receive an SMS when my server is down but not run an extra piece of software (some python or shell script), I'd like it to.
There is a crate that implements this so that I only have to run a little bit of configuation code once, then run a function on every nth loop that axum runs. Ideally to call twilio API, like so.
Where would I put this?
I'd actually like this to be part of the axum builder pattern by implementing the tower::Service() trait, is there an example of someone integrating something similar to this? This way I can publish a crate and other's can easily call it.
Beta Was this translation helpful? Give feedback.
All reactions