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:
@@ -2,12 +2,16 @@ import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from collections import defaultdict
|
||||
from typing import Any, DefaultDict, Dict, List
|
||||
|
||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
sys.path.append(ZULIP_PATH)
|
||||
from scripts.lib.zulip_tools import get_config, get_config_file
|
||||
|
||||
normal_queues = [
|
||||
"deferred_work",
|
||||
"digest_emails",
|
||||
@@ -23,6 +27,10 @@ normal_queues = [
|
||||
"user_presence",
|
||||
]
|
||||
|
||||
mobile_notification_shards = int(
|
||||
get_config(get_config_file(), "application_server", "mobile_notification_shards", "1")
|
||||
)
|
||||
|
||||
OK = 0
|
||||
WARNING = 1
|
||||
CRITICAL = 2
|
||||
@@ -154,7 +162,13 @@ def check_rabbitmq_queues() -> None:
|
||||
text=True,
|
||||
).strip()
|
||||
queue_stats: Dict[str, Dict[str, Any]] = {}
|
||||
queues_to_check = set(normal_queues).intersection(set(queues_with_consumers))
|
||||
check_queues = normal_queues
|
||||
if mobile_notification_shards > 1:
|
||||
check_queues += [
|
||||
f"missedmessage_mobile_notifications_shard{d}"
|
||||
for d in range(1, mobile_notification_shards + 1)
|
||||
]
|
||||
queues_to_check = set(check_queues).intersection(set(queues_with_consumers))
|
||||
for queue in queues_to_check:
|
||||
fn = queue + ".stats"
|
||||
file_path = os.path.join(queue_stats_dir, fn)
|
||||
|
||||
Reference in New Issue
Block a user