Пример #1
0
 def __init__(self):
     log.info('ws: pubsub init')
     pool = RedisPool(settings.pubsub_socket)
     pubsub = pool.pubsub()
     pubsub.subscribe(['msg', 'msg.self', 'sub', 'rec', 'confirm'])
     for msg in pubsub.listen():
         self.handle_message(msg)
Пример #2
0
 def __init__(self):
     log.info('ws: pubsub init')
     pool = RedisPool(settings.pubsub_socket)
     pubsub = pool.pubsub()
     pubsub.subscribe(['msg', 'msg.self', 'sub', 'rec', 'confirm'])
     for msg in pubsub.listen():
         self.handle_message(msg)
Пример #3
0
    def __init__(self):
        proctitle('sender-queue')
        log.info('sender queue started with PID=%s' % os.getpid())

        self.xsq = Queue('xsq', settings.queue_socket)

        pool = RedisPool(settings.pubsub_socket)
        pubsub = pool.pubsub()
        pubsub.subscribe(['msg', 'sub', 'rec', 'confirm', 'remember'])

        for msg in pubsub.listen():
            self.xsq.push("%s %s" % (msg['channel'], msg['data']))
Пример #4
0
    def __init__(self):
        proctitle('sender-queue')
        log.info('sender queue started with PID=%s' % os.getpid())

        self.xsq = Queue('xsq', settings.queue_socket)

        pool = RedisPool(settings.pubsub_socket)
        pubsub = pool.pubsub()
        pubsub.subscribe(['msg', 'sub', 'rec', 'confirm', 'remember'])

        for msg in pubsub.listen():
            self.xsq.push("%s %s" % (msg['channel'], msg['data']))
Пример #5
0
    def __init__(self):
        proctitle('support-worker')
        log.info('support worker started with PID=%s' % os.getpid())

        pool = RedisPool(settings.pubsub_socket)
        pubsub = pool.pubsub()
        pubsub.subscribe(['msg'])

        for msg in pubsub.listen():
            try:
                data = json.loads(msg['data'])
            except TypeError:
                continue
            if data['a'] in ('post', 'post_edited'):
                gevent.spawn(self.handle_post, data)