reset MUST_NOTIFY on request start (#29240)

It breaks test tests_hobo/test_manager.py:test_unlogged_access which do
not expect any DB access but the flag seems to still be True from a
previous test.
This commit is contained in:
Benjamin Dauvergne 2019-03-08 15:52:59 +01:00
parent b36e054cb0
commit 661a526109
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,7 @@ from celery import Celery
from kombu.common import Broadcast
from django.conf import settings
from django.core.signals import request_finished
from django.core.signals import request_finished, request_started
from django.db.models.signals import post_save
from django.dispatch import receiver
@ -43,6 +43,11 @@ def post_environment_save(sender, instance, **kwargs):
tls.MUST_NOTIFY = True
@receiver(request_started)
def reset_must_notify(sender, **kwargs):
tls.MUST_NOTIFY = False
@receiver(request_finished)
def notify_agents(sender, **kwargs):
if not tls.MUST_NOTIFY:

View File

@ -224,4 +224,4 @@
"theme": "publik",
"theme_color": "#E80E89"
}
}
}