Пример #1
0
class DisApp(tornado.web.Application):
    def __init__(self):
        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        self.task_handler = TaskHandler(self)
        return

    def task_loop(self):
        """
        every 20ms check task notification
        """
        key = REDIS_DISPATCHER_NOTIFICATION_KEY
        while True:
            noti = self.redis.lpop(key)
            if noti == None:
                # no message
                return
            body = json.loads(noti)
            self.task_handler.task(body)
        return
Пример #2
0
class DisApp(tornado.web.Application):
    def __init__(self):
        self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
        self.task_handler = TaskHandler(self)
        return
    
    def task_loop(self):
        """
        every 20ms check task notification
        """
        key = REDIS_DISPATCHER_NOTIFICATION_KEY
        while True:
            noti = self.redis.lpop(key)
            if noti == None:
                # no message
                return
            body = json.loads(noti)
            self.task_handler.task(body)
        return
Пример #3
0
class DispatcherDelegate():
    def __init__(self, app):
        self.redis = app.redis
        self.task_handler = TaskHandler(self)
        return

    def run_periodic(self):
        # every 20ms check dispatcher task
        tornado.ioloop.PeriodicCallback(self.task_loop, 20).start()
        return

    def task_loop(self):
        """
        every 20ms check task notification
        """
        key = REDIS_DISPATCHER_NOTIFICATION_KEY
        while True:
            noti = self.redis.lpop(key)
            if noti == None:
                # no message
                return
            body = json.loads(noti)
            self.task_handler.task(body)
        return
Пример #4
0
class DispatcherDelegate():
    def __init__(self, app):
        self.redis = app.redis
        self.task_handler = TaskHandler(self)
        return

    def run_periodic(self):
        # every 20ms check dispatcher task
        tornado.ioloop.PeriodicCallback(self.task_loop, 20).start()
        return

    def task_loop(self):
        """
        every 20ms check task notification
        """
        key = REDIS_DISPATCHER_NOTIFICATION_KEY
        while True:
            noti = self.redis.lpop(key)
            if noti == None:
                # no message
                return
            body = json.loads(noti)
            self.task_handler.task(body)
        return
Пример #5
0
 def __init__(self):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     self.task_handler = TaskHandler(self)
     return
Пример #6
0
 def __init__(self, app):
     self.redis = app.redis
     self.task_handler = TaskHandler(self)
     return
Пример #7
0
 def __init__(self):
     self.redis = redis.Redis(REDIS_HOST, REDIS_PORT, db=1)
     self.task_handler = TaskHandler(self)
     return
Пример #8
0
 def __init__(self, app):
     self.redis = app.redis
     self.task_handler = TaskHandler(self)
     return