mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
push_notifications: Shard mobile push notifications.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# Documented in https://zulip.readthedocs.io/en/latest/subsystems/queuing.html
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.push_notifications import (
|
||||
@@ -23,6 +24,17 @@ class PushNotificationsWorker(QueueProcessingWorker):
|
||||
# play well with asyncio.
|
||||
MAX_CONSUME_SECONDS = None
|
||||
|
||||
@override
|
||||
def __init__(
|
||||
self,
|
||||
threaded: bool = False,
|
||||
disable_timeout: bool = False,
|
||||
worker_num: Optional[int] = None,
|
||||
) -> None:
|
||||
if settings.MOBILE_NOTIFICATIONS_SHARDS > 1 and worker_num is not None: # nocoverage
|
||||
self.queue_name = self.queue_name + f"_shard{worker_num}"
|
||||
super().__init__(threaded, disable_timeout, worker_num)
|
||||
|
||||
@override
|
||||
def start(self) -> None:
|
||||
# initialize_push_notifications doesn't strictly do anything
|
||||
|
||||
Reference in New Issue
Block a user