forked from GithubBackups/healthchecks
hc.api.views.bounce updates Channel.last_error
This commit is contained in:
parent
c521b44d20
commit
b8108906f4
@ -29,6 +29,7 @@ class BounceTestCase(BaseTestCase):
|
|||||||
|
|
||||||
self.channel.refresh_from_db()
|
self.channel.refresh_from_db()
|
||||||
self.assertFalse(self.channel.email_verified)
|
self.assertFalse(self.channel.email_verified)
|
||||||
|
self.assertEqual(self.channel.last_error, "foo")
|
||||||
|
|
||||||
def test_it_checks_ttl(self):
|
def test_it_checks_ttl(self):
|
||||||
self.n.created = self.n.created - timedelta(minutes=60)
|
self.n.created = self.n.created - timedelta(minutes=60)
|
||||||
|
@ -272,9 +272,13 @@ def bounce(request, code):
|
|||||||
notification.error = request.body.decode()[:200]
|
notification.error = request.body.decode()[:200]
|
||||||
notification.save()
|
notification.save()
|
||||||
|
|
||||||
|
notification.channel.last_error = notification.error
|
||||||
if request.GET.get("type") in (None, "Permanent"):
|
if request.GET.get("type") in (None, "Permanent"):
|
||||||
|
# For permanent bounces, mark the channel as not verified, so we
|
||||||
|
# will not try to deliver to it again.
|
||||||
notification.channel.email_verified = False
|
notification.channel.email_verified = False
|
||||||
notification.channel.save()
|
|
||||||
|
notification.channel.save()
|
||||||
|
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user