Polyconseil/django-cid

Doubt - Possible problem in asynchronous applications

carlosdorneles-mb opened this issue · 2 comments

Hello gentlemen, I have a question regarding Django async applications.

I saw that in the cid/locals/ directory we have two options to set the cid, using context var and local threading.

By default the library uses local threading everywhere, but I think that in async applications we can have problems and the most correct thing would be to use context var. Correct me if I'm wrong.

Shouldn't we have a smarter way to identify whether a Django application is running sync or async and then choose when to use context var or local threading? Maybe using isinstance(request, ASGIRequest) in middleware or maybe using local from asgiref module.

Hello, it might be due to #60 .
Could you check if the newly released version 2.3 solve your issue ?

Hi, yes it solves the problem. Thanks.