Strict deco for RedisPrepareCommit

    The deco will choose whether to silent exception or not based on the
    strict attr in RedisPrepareCommit object.

def _redis_strict_pc(func):
    """Strict deco for RedisPrepareCommit

    The deco will choose whether to silent exception or not based on the
    strict attr in RedisPrepareCommit object.
    """
    phase = "session_%s" % func.__name__

    @functools.wraps(func)
    def wrapper(self, session, *args, **kwargs):
        try:
            func(self, session, *args, **kwargs)
            self.logger.debug("%s -> %s" % (session.meepo_unique_id, phase))
            return True
        except Exception as e:
            if self.strict:
                raise
            if isinstance(e, redis.ConnectionError):
                self.logger.warn("redis connection error in %s: %s" % (
                    phase, session.meepo_unique_id))
            else:
                self.logger.exception(e)
            return False
    return wrapper