Listen to redis channel for a configuration update notifications.

    Arguments:
        state (_WaffleState): Object that contains reference to app and its
            configstore.

def _redis_watcher(state):
    """Listen to redis channel for a configuration update notifications.

    Arguments:
        state (_WaffleState): Object that contains reference to app and its
            configstore.
    """
    conf = state.app.config

    r = redis.client.StrictRedis(
        host=conf.get('WAFFLE_REDIS_HOST', 'localhost'),
        port=conf.get('WAFFLE_REDIS_PORT', 6379))

    sub = r.pubsub(ignore_subscribe_messages=True)
    sub.subscribe(conf.get('WAFFLE_REDIS_CHANNEL', 'waffleconf'))

    while True:
        for msg in sub.listen():
            # Skip non-messages
            if not msg['type'] == 'message':
                continue

            tstamp = float(msg['data'])

            # Compare timestamps and update config if needed
            if tstamp > state._tstamp:
                state.update_conf()
                state._tstamp = tstamp