def update_failure(self, reason=None):
        # we use an exponential back-off to avoid submitting to bad urls
        # too frequently.
        assert self.succeeded is False
        assert self.next_check is not None
        now = datetime.utcnow()
        window = timedelta(minutes=0)
        if self.last_checked:
            window = self.next_check - self.last_checked
            window += (window // 2)  # window *= 1.5
        if window < MIN_RETRY_WAIT:
            window = MIN_RETRY_WAIT
        elif window > MAX_RETRY_WAIT:
            window = MAX_RETRY_WAIT

        self.last_checked = now
        self.next_check = self.last_checked + window
        self.failure_reason = reason
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/repeaters/models.py/RepeatRecord.update_failure/original