コード例 #1
0
def run():
    while 1:
        if Bridge().get_status():
            time.sleep(config.TIMER_CHECKER_INTERVAL)
            try:
                process()
            except KeyboardInterrupt:
                Bridge().close_connect()
                break
            except:
                timer_logger.error('exc occur.', exc_info=True)
                Bridge().close_connect()
                break
        else:
            Bridge().get_connect()
コード例 #2
0
def web_connect():
    Bridge(pro_name='web_server')

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mjango.settings")
    from django.conf import settings
    settings.BASE_DIR
    while 1:
        # 应该会有性能问题,先写着,到时候看看
        if Bridge().get_status():
            try:
                time.sleep(1)
            except KeyboardInterrupt:
                Bridge().close_connect()
                break
            except:
                logger.error('error\n', exc_info=True)
                Bridge().close_connect()
                break
        else:
            Bridge().get_connect()
コード例 #3
0
def bridge_to_users(uins, cmd, request, broadcast=False):
    if broadcast:
        uin_list = None
        cmd = dict(op_cmd=1000, send_cmd=cmd, uin_list=uin_list)
    else:
        if not isinstance(uins, list):
            uin_list = [uins]
        else:
            uin_list = uins
        cmd = dict(op_cmd=999, send_cmd=cmd, uin_list=uin_list)

    Bridge().send_data(cmd, request)
コード例 #4
0
def run():
    # 注册module
    module_register()

    job.add_listener(err_listener, EVENT_JOB_ERROR | EVENT_JOB_MISSED)
    job.start()

    while 1:
        # 应该会有性能问题,先写着,到时候看看
        if Bridge().get_status():
            try:
                time.sleep(1)
            except KeyboardInterrupt:
                Bridge().close_connect()
                break
            except:
                sche_logger.error('error\n', exc_info=True)
                Bridge().close_connect()
                break
        else:
            Bridge().get_connect()
コード例 #5
0
 def handle(self, *args, **options):
     Bridge(pro_name='timer_server')
     run()
コード例 #6
0
def celery_to_users(uins, cmd, request):
    Bridge().get_connect()
    bridge_to_users(uins, cmd, request)
    Bridge().close_connect()
コード例 #7
0
def bridge_to_other_game(cmd, request):
    Bridge().send_data(cmd, request)
コード例 #8
0
 def handle(self, *args, **options):
     Bridge(pro_name='schedule_server')
     run()