forked from GithubBackups/healthchecks
sendalerts was not using the api_check (status, user_id, alert_after) index so removing it. The index was not selective enough.
This commit is contained in:
parent
c4b316003d
commit
1392226538
@ -28,7 +28,7 @@ def notify_on_thread(check_id, stdout):
|
|||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'Sends UP/DOWN email alerts'
|
help = 'Sends UP/DOWN email alerts'
|
||||||
owned = Check.objects.filter(user__isnull=False)
|
owned = Check.objects.filter(user__isnull=False).order_by("alert_after")
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
19
hc/api/migrations/0036_auto_20180116_2243.py
Normal file
19
hc/api/migrations/0036_auto_20180116_2243.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.6 on 2018-01-16 22:43
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0035_auto_20171229_2008'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterIndexTogether(
|
||||||
|
name='check',
|
||||||
|
index_together=set([]),
|
||||||
|
),
|
||||||
|
]
|
@ -57,11 +57,6 @@ def isostring(dt):
|
|||||||
|
|
||||||
|
|
||||||
class Check(models.Model):
|
class Check(models.Model):
|
||||||
|
|
||||||
class Meta:
|
|
||||||
# sendalerts command will query using these
|
|
||||||
index_together = ["status", "user", "alert_after"]
|
|
||||||
|
|
||||||
name = models.CharField(max_length=100, blank=True)
|
name = models.CharField(max_length=100, blank=True)
|
||||||
tags = models.CharField(max_length=500, blank=True)
|
tags = models.CharField(max_length=500, blank=True)
|
||||||
code = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True)
|
code = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user