Fix up usage of django-guid

It has replaced the class-based middleware, everything is
function-based now.
This commit is contained in:
Jeff Bradberry
2022-02-17 10:54:15 -05:00
parent 23e700a1ef
commit 1803c5bdb4
8 changed files with 17 additions and 16 deletions

View File

@@ -6,7 +6,8 @@ from multiprocessing import Process
from django.conf import settings
from django.db import connections
from schedule import Scheduler
from django_guid.middleware import GuidMiddleware
from django_guid import set_guid
from django_guid.utils import generate_guid
from awx.main.dispatch.worker import TaskWorker
@@ -32,7 +33,7 @@ class Scheduler(Scheduler):
# If the database connection has a hiccup, re-establish a new
# connection
conn.close_if_unusable_or_obsolete()
GuidMiddleware.set_guid(GuidMiddleware._generate_guid())
set_guid(generate_guid())
self.run_pending()
except Exception:
logger.exception('encountered an error while scheduling periodic tasks')