Replies: 3 comments
-
|
I am also curious, have you actually experienced problems using |
Beta Was this translation helpful? Give feedback.
-
|
Also worth looking at: Allows extending workers with something like |
Beta Was this translation helpful? Give feedback.
-
I don't have an issue, I looked at the code and I remembers you said it's a goal to not have any extra unnecessary global stuff, that's why I opened an issue. Feel free to close it if it's not a priority. I noticed some of the extension traits are being done on worker level instead of the task level which I was looking for (like task level circuit breaker). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Usually, the state should be well-defined ahead of time, but currently apalis uses a
HashMap<TypeId, State>(simplified).https://github.com/geofmureithi/apalis/blob/28353732e45277c21966f0265464ff57b8159ec9/packages/apalis-core/src/data.rs#L10
Axum provides an option here to use the state extractor, once globally (actually per router).
https://github.com/tokio-rs/axum/blob/c4890b844b0534f5b005342ef268b9ef620c875a/axum/src/routing/mod.rs#L726-L732
So here users could have a struct instead, and this would be resolved compile-time.
Axum does have anymap but it's for extensions, and it would be rarer for such cases such that state is not known ahead of time, using https://docs.rs/http/latest/http/struct.Extensions.html.
Beta Was this translation helpful? Give feedback.
All reactions