mirror of
https://github.com/zulip/zulip.git
synced 2025-11-23 07:52:35 +00:00
Previous cleanups (mostly the removals of Python __future__ imports) were done in a way that introduced leading newlines. Delete leading newlines from all files, except static/assets/zulip-emoji/NOTICE, which is a verbatim copy of the Apache 2.0 license. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
26 lines
719 B
Python
26 lines
719 B
Python
"""
|
|
Shows backlog count of ScheduledEmail
|
|
"""
|
|
|
|
|
|
from datetime import timedelta
|
|
from typing import Any
|
|
|
|
from django.core.management.base import BaseCommand
|
|
from django.utils.timezone import now as timezone_now
|
|
|
|
from zerver.models import ScheduledEmail
|
|
|
|
class Command(BaseCommand):
|
|
help = """Shows backlog count of ScheduledEmail
|
|
(The number of currently overdue (by at least a minute) email jobs)
|
|
|
|
This is run as part of the nagios health check for the deliver_email command.
|
|
|
|
Usage: ./manage.py print_email_delivery_backlog
|
|
"""
|
|
|
|
def handle(self, *args: Any, **options: Any) -> None:
|
|
print(ScheduledEmail.objects.filter(
|
|
scheduled_timestamp__lte=timezone_now()-timedelta(minutes=1)).count())
|