How to set tokio::task_local
for server so that every handlers can use the same local static?
#2867
Unanswered
hlf20010508
asked this question in
Q&A
Replies: 1 comment
-
See this example from the documentation: https://docs.rs/axum/0.7.7/axum/#using-tokios-task_local-macro |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I use
to spawn a coroutine for axum server, and use
EVENT_INDENTER
in each handler.I expect every handlers share the same
EVENT_INDENTER
, but different from the one in other coroutines.But it panic at
The indenter works fine in other coroutines except axum.
It seems that handlers are not in the same coroutine with the server.
Do anyone know how to fix this?
axum version
0.7.5
Beta Was this translation helpful? Give feedback.
All reactions