

def _fire_reminder(reminder_id):
    utcnow = datetime.utcnow()
    reminder = CaseReminder.get(reminder_id)
    key = ('rule-update-definition-%s-case-%s' % (reminder.handler_id, reminder.case_id))
    with CriticalSection([key], timeout=(settings.REMINDERS_QUEUE_PROCESSING_LOCK_TIMEOUT * 60)):
        reminder = CaseReminder.get(reminder_id)
        if ((not reminder.retired) and reminder.active and (utcnow >= reminder.next_fire)):
            handler = reminder.handler
            if reminder_is_stale(reminder, utcnow):
                handler.set_next_fire(reminder, utcnow)
                reminder.save()
                return
            if handler.fire(reminder):
                handler.set_next_fire(reminder, reminder)
                reminder.save()

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/reminders/tasks.py _fire_reminder/VarMisuse@146/214 `utcnow`->`reminder`