You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by euri10 April 1, 2021
long story short I was writing a logging middleware whose handlers are initialized in the __init__ of the middleware and ended up with multiple logs.
it seems to me the __init__ of the middlewarea are recursively called because of the build_middleware_stack method and I'm not sure if this is intended or a bug.
here's a test case that shows what I think is an issue:
I would expect to see 1 2 3 4 as the output.
however it prints 1 1 2 1 2 3 1 2 3 4 because for each add_middlware call it goes down the stack and reinitialize it.
Discussed in #1161
Originally posted by euri10 April 1, 2021
long story short I was writing a logging middleware whose handlers are initialized in the
__init__
of the middleware and ended up with multiple logs.it seems to me the
__init__
of the middlewarea are recursively called because of thebuild_middleware_stack
method and I'm not sure if this is intended or a bug.here's a test case that shows what I think is an issue:
I would expect to see
1 2 3 4
as the output.however it prints
1 1 2 1 2 3 1 2 3 4
because for each add_middlware call it goes down the stack and reinitialize it.what you think @tomchristie ?
The text was updated successfully, but these errors were encountered: