forked from GithubBackups/healthchecks
Sort by id, not created
, when pruning pings.
This commit is contained in:
parent
7019325b48
commit
b9ae8d464c
@ -104,7 +104,7 @@ class Check(models.Model):
|
||||
|
||||
"""
|
||||
|
||||
pings = Ping.objects.filter(owner=self).order_by("-created")
|
||||
pings = Ping.objects.filter(owner=self).order_by("-id")
|
||||
cutoff = pings[keep_limit:keep_limit+1]
|
||||
|
||||
# If cutoff is empty slice then the check has less than `keep_limit`
|
||||
|
@ -9,7 +9,7 @@ class CheckModelTestCase(TestCase):
|
||||
check.save()
|
||||
|
||||
for i in range(0, 6):
|
||||
p = Ping(pk=100 + i, owner=check, ua="UA%d" % i)
|
||||
p = Ping(owner=check, ua="UA%d" % i)
|
||||
p.save()
|
||||
|
||||
check.prune_pings(keep_limit=3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user