Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

queue_processors: Disable missedmesssage worker on staging.

Tim Abbottc134cc3136e5
diff --git a/zerver/worker/missedmessage_emails.py b/zerver/worker/missedmessage_emails.py
index ef84ef23d58..0e696d39d41 100644
--- a/zerver/worker/missedmessage_emails.py
+++ b/zerver/worker/missedmessage_emails.py
@@ -6,6 +6,7 @@ from datetime import timedelta
from typing import Any
import sentry_sdk
+from django.conf import settings
from django.db import transaction
from django.db.utils import IntegrityError
from django.utils.timezone import now as timezone_now
@@ -111,6 +112,14 @@ class MissedMessageWorker(QueueProcessingWorker):
def start(self) -> None:
with self.cv:
self.stopping = False
+
+ # Do nothing to process events on staging servers, since we do
+ # not support running multiple copies of this worker.
+ if settings.STAGING:
+ with self.cv:
+ self.cv.wait()
+ return
+
self.worker_thread = threading.Thread(target=self.work)
self.worker_thread.start()
super().start()
@@ -263,4 +272,8 @@ class MissedMessageWorker(QueueProcessingWorker):
self.cv.notify()
if self.worker_thread is not None:
self.worker_thread.join()
+
+ if settings.STAGING:
+ return
+
super().stop()