Try to re-apply a failed trigger log action.

    Makes sure the argument trigger log is in a FAILED state and acquires a row lock on it.

    Returns:
          True if the operation succeeded

def _retry_failed_log(failed_trigger_log):
    """
    Try to re-apply a failed trigger log action.

    Makes sure the argument trigger log is in a FAILED state and acquires a row lock on it.

    Returns:
          True if the operation succeeded

    """
    model = type(failed_trigger_log)
    try:
        failed_trigger_log = (
            model.objects
            .select_for_update()
            .get(
                id=failed_trigger_log.id,
                state=TRIGGER_LOG_STATE['FAILED'],
            )
        )
    except model.DoesNotExist:
        return False
    failed_trigger_log.redo()
    return True