Skip to content

Commit b23e72f

Browse files
ehabel-kadylnagel
authored andcommitted
replace Local with asgiref.Local
1 parent d651e41 commit b23e72f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

django_datadog_logger/celery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from functools import wraps
22

3-
from django_datadog_logger.local import Local, release_local # NOQA
3+
from asgiref.local import Local # NOQA
44

55
local = Local()
66

@@ -31,7 +31,7 @@ def function_wrapper(*args, **kwargs):
3131
local.request = request
3232
return func(*args, **kwargs)
3333
finally:
34-
release_local(local)
34+
del local.request
3535

3636
return function_wrapper
3737

django_datadog_logger/middleware/request_id.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33
import uuid
44

5-
from django_datadog_logger.local import release_local
65
from django_datadog_logger.wsgi import local
76

87

@@ -28,5 +27,5 @@ def __call__(self, request):
2827
local.request = request
2928
response = self.get_response(request)
3029
response["X-Request-ID"] = request.request_id
31-
release_local(local)
30+
del local.request
3231
return response

django_datadog_logger/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django_datadog_logger.local import Local # NOQA
1+
from asgiref.local import Local # NOQA
22

33
local = Local()
44

0 commit comments

Comments
 (0)