def clean_expired_transient_emails(): try: TransientBounceEmail.delete_expired_bounces() except Exception as e: notify_exception(None, message="Encountered error while deleting expired " "transient bounce emails", details={ 'error': e, })
def test_expired_transient_cleanup(self): self.assertEqual( TransientBounceEmail.get_expired_query().count(), BOUNCE_EVENT_THRESHOLD + 1 ) TransientBounceEmail.delete_expired_bounces() self.assertEqual( TransientBounceEmail.get_expired_query().count(), 0 )