コード例 #1
0
ファイル: queue.py プロジェクト: philpep/flasque
def iter_messages_pubsub(channels, prefix="channel", timeout=1):
    pub = db.pubsub()
    if channels:
        pub.subscribe(["%s:%s" (prefix, channel) for channel in channels])
    else:
        pub.psubscribe(["%s:*" % (prefix)])
    while True:
        yield get_message_pubsub(pub, timeout=timeout)
コード例 #2
0
ファイル: queue.py プロジェクト: philpep/flasque
def iter_messages_pubsub(channels, prefix="channel", timeout=1):
    pub = db.pubsub()
    if channels:
        pub.subscribe(["%s:%s" (prefix, channel) for channel in channels])
    else:
        pub.psubscribe(["%s:*" % (prefix)])
    while True:
        yield get_message_pubsub(pub, timeout=timeout)
コード例 #3
0
ファイル: queue.py プロジェクト: philpep/flasque
def iter_status():
    pub = db.pubsub()
    pub.subscribe(["queues:status"])
    yield get_status()
    while True:
        channel = get_message_pubsub(pub)
        if channel is not None:
            yield get_status(channel)
        else:
            yield
コード例 #4
0
ファイル: queue.py プロジェクト: philpep/flasque
def iter_status():
    pub = db.pubsub()
    pub.subscribe(["queues:status"])
    yield get_status()
    while True:
        channel = get_message_pubsub(pub)
        if channel is not None:
            yield get_status(channel)
        else:
            yield