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
Is the simple task_factory used in the PoC example the best choice?
It seems you'd want the request id to propagate to child tasks created within request processing. So one of the other two task factories seem more appropriate. Likely the copying one.
Is that correct understanding? I wonder if the example should be updated.
Side note -- this functionality is super useful, and should be more deeply merged into asyncio IMO.
The text was updated successfully, but these errors were encountered:
Hey @nikhilk sorry for the delay, been on annual leave for couple of months :).
With the simple task factory, a dict is used and the dict is propagated from parent to child. A simple child_context = parent_context is done. This has the side effect that if you update an already existing key in the child, the parent will also be affected because it is the same object. If you don't want this behavior, you can set the copy_context variable to True and then deepcopy will be use (with the extra overhead this implies).
Side note -- this functionality is super useful, and should be more deeply merged into asyncio IMO.
Glad you like it, it's proven very useful for us and it is really simple to use. In Python 3.7 you can use contextvars module (pep-567)
Is the simple task_factory used in the PoC example the best choice?
It seems you'd want the request id to propagate to child tasks created within request processing. So one of the other two task factories seem more appropriate. Likely the copying one.
Is that correct understanding? I wonder if the example should be updated.
Side note -- this functionality is super useful, and should be more deeply merged into asyncio IMO.
The text was updated successfully, but these errors were encountered: