def _connect_rbt_server(self): ''' connnect to rabbitmq server params string server_url amqp的url return 1表示成功 ''' server_url = self.rbt_server_list[self.current_node_index] try: self.client = puka.Client(server_url) promise = self.client.connect() res = self.client.wait(promise) if res and res.has_key('server_properties'): logging.info('connect to rabbitmq-server [%s] success',server_url) else: logging.error('fail to connect or init rabbitmq-server ,amqp url is [%s] error is [%s]',server_url, traceback.format_exc()) return -1 if not self.declare_my_exchange(): #declare exchange return -4 if not self.declare_my_queue(self.my_q_name): #declare myself queue error return -2 if not self.declare_group_queue(self.my_grp_qname): #declare my group queue error return -3 if self.type == 'read': self.get_consume_promise( [self.my_q_name, self.my_grp_qname]) logging.info('success init to rabbitmq-server [%s] success',server_url) return 1 except: logging.error('fail to connect or init rabbitmq-server ,amqp url is [%s] error is [%s]',server_url, traceback.format_exc()) time.sleep(0.3) return -1
def ping_send(remotename, interval = 100): ''' 向给自己发消息 params tuple remotename (groupname, servicename) int interval 每隔多久发一次消息 ''' try : global MONITOR_RBT_WRITE global MBC global reply_info while True: MBC._end_event.wait(interval) if MBC._end_event.isSet(): break try: data = { "0003":{"0005":0x00000001}, "0004":{}, } data = JsonUtil.write( data ) MONITOR_RBT_WRITE.send(remotename, data) if True == reply_info['is_reply']: reply_info['is_reply'] = False reply_info['ping_time'] = time.time() logging.info('send [ping] to myself through rabbitmq') except: logging.warning('from ping_send %s',traceback.format_exc()) except Exception,ex: logging.error( "Error: %s" % ex ) logging.error( traceback.format_exc() )
def init(q_name, my_app_name): ''' ''' swtich = XmlConfig.get('/monitor') if swtich.get('switch','OFF').upper() == 'OFF': global SWITCH logging.info('the monitor is not turing on') SWITCH = 'OFF' return monitor_serv_info = XmlConfig.get('/monitor/monitor_serv_addr') host = monitor_serv_info['host'] port =int(monitor_serv_info['port']) max_idle_time = XmlConfig.get('/monitor/max_idle_time') alert_inverval = XmlConfig.get('/monitor/alert_interval') keepers_info = XmlConfig.list('/monitor/keepers/') emails = [] mobiles = [] for i in keepers_info.values(): emails.extend(i['emails'].split(',')) mobiles.extend(i['mobiles'].split(',')) global MBC MBC = Client(my_app_name, (host, port) ) res = MBC.register({ 'mobiles': mobiles, 'emails' : emails, 'max_idle_time': int(max_idle_time), 'alert_interval': alert_inverval, }) if res['code'] != 201: logging.warning('monitor register %s',res)
def judge_qianquan_user(match): ''' 比较钱圈人数,当前人数 进入钱圈后不能rebuy、addon 入参: 出参:True/False True:可以rebuy/addon False:不可以 编写:liulk 日期:2012.11.08 13:52 ''' if not match: logging.info('JUDGE: match----> %s' % match) return False #取钱圈比率,钱圈比为0比赛为实物奖励,奖池变动无影响 inthemoney_ratio = match.conf.inthemoney_ratio #logging.info('match[%s] inthemoney_ratio = %s'%(match.match_id, inthemoney_ratio)) if inthemoney_ratio == 0: return True #总人数 total_users = len(match.user_list) #钱圈人数 inthemoney_num = int(total_users * inthemoney_ratio / 100) #当前剩余玩家数目 = 总数 - 已经淘汰的 alive_user_num = total_users - len(match.player_lose_list) #logging.info('total_users[%s], inthemoney_num[%s], alive_user_num[%s]' #%(total_users, inthemoney_num, alive_user_num)) if alive_user_num <= inthemoney_num: return False else: return True
def generate_game_list( self, table_num_create, target_gameaddr = None, sort = 'NO', type = 'NO' ): ''' 功能:根据要创建的牌桌个数,生成游戏服务列表 入参:sort : 牌桌大类 CASH/MATCH type : 牌桌子类 RAKEPOINT/GOLD TOURNEY/SITANDGO 出参:glist ''' logging.info('table_num = %s, target_gameaddr = %s, sort = %s, type = %s' %(table_num_create, target_gameaddr, sort, type)) glist = [] # 1.如果有指定的Game服务,则直接把桌子全部创到这个服务上去 if target_gameaddr in self.game_list: for i in range( table_num_create ): game_name = target_gameaddr remote_addr = (Config.GAME_GROUP_NAME, game_name) glist.append( remote_addr ) self.inc_table_count( game_name, table_num_create ) return glist #记录一下错误信息 if target_gameaddr != None: logging.error('generate_game_list: not exist gameaddr [%s] '%target_gameaddr) gameaddr_list = self.get_target_gameaddr(table_num_create, sort, type) if len( gameaddr_list ) <= 0: logging.error( 'there is not single game address!' ) return self # 2.只有一个地址的情况下,很好处理 if len( gameaddr_list ) == 1: for i in range( table_num_create ): game_name = gameaddr_list.keys()[0] remote_addr = (Config.GAME_GROUP_NAME, game_name) glist.append( remote_addr ) self.inc_table_count( game_name, table_num_create ) return glist # 3.其他情况:取最多、最少牌桌的游戏 # 算法的基本思路是: # 取最小牌桌数量的Game服务 for i in range( table_num_create ): max_name, min_name = get_max_and_min_table_game( gameaddr_list ) # 取到一个游戏地址 game_name = min_name remote_addr = (Config.GAME_GROUP_NAME, game_name) # 登记到缓存 glist.append( remote_addr ) self.inc_table_count( game_name ) gameaddr_list[ game_name ] += 1 return glist
def check(): gamerouter = get_gamerouter() logging.info('GameServer: %s'%gamerouter.game_list) game_addr_map = Memory.getall( Config.GAME_ADDR_PREFIX ) latest_game_list = game_addr_map.keys() #最新的Game服务列表 old_game_list = gamerouter.game_list.keys() #旧的Game服务列表 # 插入没有的 for serv_name in latest_game_list: gamerouter.add_gameaddr( serv_name ) # 去掉消失的 for serv_name in old_game_list: if serv_name not in latest_game_list: gamerouter.remove_gameaddr( serv_name ) # 更新t_config_match_addr total_table_num = gamerouter.get_total_tablenum() serv_name = sys.argv[1] addr = ( Config.LOCAL_GROUP_NAME, serv_name ) addr = str(addr) Match.update_match_addr_config_tnum( total_table_num, addr )
def record_create_table(table_id, pay_type, big_blind, game_addr): ''' 记录不同盲注级别的桌子所在的game服务地址 ''' logging.debug( 'record_create_table: table_id = %s, pay_type = %s, big_blind = %s' % (table_id, pay_type, big_blind)) #game_addr = get_gaddr_from_tid(table_id) #解析table_id 得到gameaddr sub_key = pay_type + '_' + str(big_blind) level_gaddr = get(LEVEL_GADDR_PREFIX, sub_key) #获取等级-地址映射数据结构 logging.debug('level_gaddr------> %s' % level_gaddr) if level_gaddr == None: set(LEVEL_GADDR_PREFIX, sub_key, game_addr) return if game_addr not in level_gaddr: #redis中没有对应的信息,写一条进去 set(LEVEL_GADDR_PREFIX, sub_key, game_addr) else: logging.info('redis has already record the info! %s : %s' % (sub_key, game_addr))
def back_user_createroom_card(user_id, card_id): ''' 返回用户开房卡 ''' db = Db.Mysql.connect('esun_texas') # 获取用户已获得的道具信息 sql = '''select f_id USER_PROPS_ID from t_user_props where f_uid = %s and f_props_id = %s and f_status = 'INUSE' ''' args = (int(user_id), int(card_id)) logging.info('**** back_user_createroom_card, sql:%s, args:%s', str(sql), str(args)) ret1 = db.query( sql, args ) numb = 1 if len(ret1) == 0: #插入 sql = ''' select f_props_id PROPS_ID, f_props_name PROPS_NAME, f_desc PROPS_DESC, f_group PROPS_GROUP, f_img_url IMG_URL, f_is_instant_use IS_INSTANT_USE, f_func_args FUNC_ARGS, f_props_limit PROPS_LIMIT, f_allow_add ALLOW_ADD, f_examine EXAMINE from t_props_config where f_props_id = %s ''' params = (card_id) ret2 = db.query( sql, params ) if (len(ret2) > 0): prop_info = ret2[0] props_args = [user_id, prop_info['PROPS_ID'], prop_info['PROPS_NAME'], prop_info['PROPS_GROUP'], prop_info['IMG_URL'], '', numb, 'INUSE', prop_info['FUNC_ARGS'], 'YES', prop_info['PROPS_DESC'], '' ] ''' 插入玩家道具表 ''' sql = ''' insert into t_user_props (f_uid, f_props_id, f_props_name, f_group, f_img_url, f_props_limit, f_props_nums, f_status, f_func_args, f_allow_add, f_desc, f_instime, f_uptime, f_remark) values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, now(), now(), %s) ''' pOther = props_args db.insert(sql, pOther) db.commit() return 1 else: sql = ''' update t_user_props set f_props_nums = f_props_nums + %s, f_uptime = now(), f_instime = now() where f_id = %s ''' args = [numb, ret1[0]['USER_PROPS_ID']] db.execute(sql, args) db.commit() return 1
def clear_table_flag(self, table_id, reason): '''清标志位''' logging.info('---------------->IN clear_table_flag') if self.table_dict.has_key(table_id): self.table_dict[table_id][reason] = False return True else: return False
def alert(self, short_msg, long_msg, encoding='utf-8'): """发送告警 """ self._call('alert', { 'short_msg': short_msg, 'long_msg': long_msg, 'encoding': encoding, }) logging.info('send alert:%s, %s', short_msg, long_msg)
def add_gameaddr( self, server_name ): ''' 添加一个游戏服务 ''' if self.game_list.has_key( server_name ): return logging.info('add a gameaddr [%s]'%server_name) self.game_list[server_name] = 0 #初始化该服务下挂载牌桌数量为0
def update_inthemoney_ratio(match_id, inthemoney_ratio): '''更新赛事钱圈比''' sql = '''UPDATE t_match SET f_inthemoney_ratio = %s, f_uptime = now() WHERE f_id = %s''' args = (inthemoney_ratio, match_id) ret = Db.Mysql.connect('esun_texas').execute(sql, args) logging.info('Update match[%s] inthemoney_ratio[%s]'%(match_id, inthemoney_ratio))
def supply_table_flag(self, reason): '''补签标志位''' table_id_list = self.table_dict.keys() for i in table_id_list: if not self.table_dict[i][reason]: self.table_dict[i][reason] = True self.pause_table_count(reason) logging.info('supply_table_flag for tables: %s' % table_id_list)
def apply_match(self, matchid, userid, username=''): ''' 赛事报名 params int id 赛事id ''' #加入赛事的用户列表 #logging.info('**** MatcherServer bg, mathid:%s, uid:%s', str(matchid), str(userid)) match = MatchData.get(matchid) if not match: #logging.info('**** MatcherServer, apply_match, unknow match, id:%s', str(matchid)) return False #重复报名的要退款 if match.user_list.count( str(userid) ) > 0: msg = { P.MATCH_ID : matchid, P.USER_ID : userid, P.USER_NAME : username, P.BUSISORT : 'MATCH_GAME', P.BUSINO : 'APPLY', } remotename = AGENT_ADDRESS c_sequence_id = '' data = P.pack().event( P.REPEAT_APPLY_BACKMONEY ).mid( c_sequence_id ).body( msg ).get() Message.send( remotename, data ) logging.info('REPEAT_APPLY_BACKMONEY---->%s'%msg) return False match.user_list.append( str(userid) ) match.user_conf[ str(userid) ] = {} match.user_conf[ str(userid) ][ 'username' ] = username match.user_conf[ str(userid) ][ 'user_agent' ] = '' match.user_conf[ str(userid) ][ 'is_trustee' ] = False #是否是托管状态 match.user_conf[ str(userid) ][ 'rebuy_times' ] = 0 #玩家已经rebuy的次数 match.user_conf[ str(userid) ][ 'rebuy_money' ] = 0 #玩家已经rebuy到的筹码 match.user_conf[ str(userid) ][ 'pro_rebuy_money' ] = 0 #预买筹码,还没到帐的筹码 match.user_conf[ str(userid) ][ 'rebuy_orderid' ] = [] #订单id:(lobby_orderid, acct_orderid) # 电竞赛额外处理 added by WangJian if (match.level == 'E_SPORTS'): lists = MatchDB.get_e_sport_extral_matchs(matchid) for i in lists: sub_match = MatchData.get( i['sub_id'] ) if not sub_match: continue sub_match.user_list.append( str(userid) ) sub_match.user_conf[ str(userid) ] = {} sub_match.user_conf[ str(userid) ][ 'username' ] = username sub_match.user_conf[ str(userid) ][ 'user_agent' ] = '' sub_match.user_conf[ str(userid) ][ 'is_trustee' ] = False #是否是托管状态 sub_match.user_conf[ str(userid) ][ 'rebuy_times' ] = 0 #玩家已经rebuy的次数 sub_match.user_conf[ str(userid) ][ 'rebuy_money' ] = 0 #玩家已经rebuy到的筹码 sub_match.user_conf[ str(userid) ][ 'pro_rebuy_money' ] = 0 #预买筹码,还没到帐的筹码 sub_match.user_conf[ str(userid) ][ 'rebuy_orderid' ] = [] #订单id:(lobby_orderid, acct_orderid)
def update_config_use_status(cash_id, status): ''' 更改配置使用状态 ''' sql = '''update t_cash_table_config set f_in_use = %s, f_uptime = now() where f_id = %s''' args = (status, cash_id ) ret = Db.Mysql.connect('esun_texas').execute(sql, args) logging.info('update cash_table_config in use NO, cash[%s]'%cash_id)
def receiveMessage(): msg = message_read.receive( 1 ) if msg != ( None, None, None ): logging.info( "receive msg ,groupname :%s ,servername : %s , msg is %s"% (msg[0],msg[1],msg[2]) ) return msg return None, None, None
def del_pause_match(match_id): '''del''' global _PAUSE_MATCH_DICT_ if _PAUSE_MATCH_DICT_.has_key(match_id): del _PAUSE_MATCH_DICT_[match_id] logging.info('del pause_match[%s] from _PAUSE_MATCH_DICT_' % match_id) return True else: logging.error( 'from del_pause_match: no pause_match[%s] in _PAUSE_MATCH_DICT_' % match_id) return False
def inc_table_count(self, game_name, count = 1): ''' 增加game服务下挂载的牌桌数量 ''' try: self.rlock.acquire() #申请锁 if game_name not in self.game_list: logging.error('from inc_table_count : game_name [%s] not in game_list'%game_name) return False self.game_list[game_name] += count logging.info('%s table_num + %s'%(game_name, count)) finally: self.rlock.release() #释放锁
def check_real_addon(self): '''检查该场比赛是否可以正式addon了''' match = MatchObject.get(self.match_id) if match == None: logging.error('not existmatch_id[%s]' % (match_id)) return total_table_num = len(match.table_list) - match.destroying_table_num logging.info('check_real_addon match[%s] total_table_num = %s' % (self.match_id, total_table_num)) if self.addon_table_num >= total_table_num: return True else: return False
def check_user_online_status(userid): ''' 查redis,检查用户连接信息,看用户是否在线 入参:userid 出参:True, 在线 False, 不在线 编写:liulk 日期:2012.08.13 11:33 ''' key = Config.USER_ADDR_PREFIX + str(userid) user_addr = Memory.getUserConnection(key) logging.info('userid: %s, user_addr: %s' % (userid, str(user_addr))) if not user_addr: return False else: return True
def del_talbe_count(self, game_name, count = 1): ''' 减少game服务下挂载的牌桌数量 ''' try: self.rlock.acquire() if game_name not in self.game_list: logging.error('from del_talbe_count : game_name [%s] not in game_list'%game_name) return False self.game_list[game_name] -= count logging.info('del_talbe_count : %s realtime table_num %s : '%( game_name, self.game_list[game_name] )) #if self.game_list[game_name] < 0: # self.game_list[game_name] = 0 finally: self.rlock.release()
def del_cash_table_list(table_id): ''' 从牌桌列表中清楚指定牌桌 ''' sql = '''delete from t_table_succ_user_enter where table_id = %s''' args = (table_id,) Db.Mysql.connect('esun_texas').execute(sql, args) sql = '''delete from t_cash_table_list where f_id = %s''' args = (table_id, ) ret = Db.Mysql.connect('esun_texas').execute(sql, args) logging.info('delete cash table %s'%table_id)
def kickout_offline_user(self, match_id): ''' 强制不在线玩家退赛 入参:match_id 出参:offline_user_list 被踢玩家列表 编写:liulk 日期:2012.08.08 11:56 ''' #检查赛事配置,是否需要踢出不在线玩家 ret = MatchDB.kickout_or_not(match_id) if not ret: #不用踢人 return None else: #要踢人 #初始化踢人列表 offline_user_list = [] #取该赛事参赛人员列表 userlist = [] for item in MatchData.get(match_id).user_list: userlist.append(item) logging.info('apply userlist is----------> : %s'%userlist) userlist_len = len(userlist) for val in range(userlist_len): #检查该用户是否在线True or False online = Player.check_user_online_status( userlist[val] ) if online: continue else: #不在线,要踢掉他了,将userid加入踢人列表 offline_user_list.append(userlist[val]) #同时更新内存中的user_list, user_conf self.quit_match(match_id, userlist[val]) #将踢人列表发给代理服务,进行强制退赛 msg = { P.MATCH_ID : match_id, P.PLAYER_LIST : offline_user_list, } remotename = AGENT_ADDRESS logging.info('remotename is : %s'%str(remotename)) c_sequence_id = '' # 取子序列号 data = P.pack().event( P.KICKOUT_OFFLINE_USER ).mid( c_sequence_id ).body( msg ).get() Message.send( remotename, data ) logging.info('Inform lobby_misc to kick out the offline users!') logging.info('OFFLINE USER_LIST: %s'%offline_user_list) return offline_user_list
def get_uncharge_chip_in_reduce_box(table_id): ''' 牌桌解散时,返回还有保管费没有结算的信息 ''' sql = ''' select f_userid BOX_UID from t_reduce_chips_info where f_tableid = %s group by f_userid ''' args = (table_id) ret1 = Db.Mysql.connect('esun_texas').query(sql, args) if len(ret1) == 0: return ret1 ret = [] logging.info('*** get_uncharge_chip_in_reduce_box 1 ret:%s', str(ret1)) for i in ret1: chips = get_player_chips_in_reduce_box(table_id, i['BOX_UID']) logging.info( '*** get_uncharge_chip_in_reduce_box 2 , tableid:%s, uid:%s, chips:%s', str(table_id), str(i['BOX_UID']), str(chips)) if (chips > 0): # 根据桌子id与uid,获取玩家最后的player_id sql2 = ''' select f_id LAST_PLAYER_ID, f_username USER_NAME from t_cash_player_finish where f_uid = %s and f_table_id = %s order by f_id desc limit 1 ''' args2 = (i['BOX_UID'], table_id) ret2 = Db.Mysql.connect('esun_texas').query(sql2, args2) logging.info('*** get_uncharge_chip_in_reduce_box 3 ret:%s', str(ret2)) if len(ret2) == 1: logging.info('*** get_uncharge_chip_in_reduce_box 4') u_info = {} u_info['UID'] = i['BOX_UID'] u_info['USERNAME'] = ret2[0]['USER_NAME'] u_info['PLAYER_ID'] = ret2[0]['LAST_PLAYER_ID'] u_info['BOX_CHIPS'] = chips ret.append(u_info) logging.info('*** get_uncharge_chip_in_reduce_box ret:%s', str(ret)) return ret
def ping_send(remotename, interval = 100): ''' 向给自己发消息 params tuple remotename (groupname, servicename) int interval 每隔多久发一次消息 ''' global MONITOR_RBT_WRITE global MBC while True: MBC._end_event.wait(interval) if MBC._end_event.isSet(): break try: data = { "0003":{"0005":0x00000001}, "0004":{}, } MONITOR_RBT_WRITE.send(remotename, data) logging.info('send [ping] to myself through rabbitmq') except: logging.warning('from ping_send %s',traceback.format_exc())
def need_addon(match, player_count): ''' 判断是否到addon时间 入参:match对象, table对象 出参:True/False 编写:liulk 日期:2012.10.29 10:37 ''' try: #配置为可以addon的赛事,且没有addon过的才可以addon,最后一个人的时候不触发addon if match.conf.addon == 'YES' and match.has_addon == False and player_count > 1: #判断到达钱圈人数没有,如到达不能addon ret = judge_qianquan_user(match) # 防止有牌桌已经在这之前进入等候addon的状态,导致比赛卡住的bug if not ret: if get_pause_match(match.match_id): logging.info( 'need_addon: already in qianquan, but some tables are in _PAUSE_MATCH_DICT_' ) else: logging.debug( 'from need_addon: IN qianquan no addon! match[%s]' % match.match_id) return False #判断是否到达相应的盲注级别 blind_conf = match.get_blind_conf() next_blindlevel = int(blind_conf[3]) #要升盲了,升盲前最终加码的机会到了。。 if next_blindlevel > match.conf.rebuy_blindlevel: logging.info('match[%s] : time to addon!' % match.match_id) return True else: return False #logging.info('match[%s] : not setted addon!'%match.match_id) return False except: logging.error('Some error: need_addon---->%s' % (traceback.format_exc())) return False
def finish_cash_player(player_id): ''' 功能:移动指定玩家到完成表里 编写:chend 创建:2012-2-9 15:07:18 修改: ''' logging.info('move to t_cash_player_finish[%s]' % player_id) sql_insert = ''' insert into t_cash_player_finish select * from t_cash_player where f_id =%s ''' sql_delete = ''' delete from t_cash_player where f_id = %s ''' args = (player_id) ret = Db.Mysql.connect('esun_texas').execute(sql_insert, args) args = (player_id) ret = Db.Mysql.connect('esun_texas').execute(sql_delete, args) return ret
def insert_create_table_comsump(config_id, subtype, user_id, comsump_type): ''' 插入朋友局创建房间时实际的消耗 ''' logging.info('********** insert_create_table_comsump bg, subtype:%s, comsump_type:%s', str(subtype), str(comsump_type)) #if int(subtype) == 0: # logging.info('********** insert_create_table_comsump , subtype = 0') # return 0 buy_type = comsump_type buy_money = 0 card_id = 0 logging.info('********** get_auto_buy_info bg') ret = get_auto_buy_info(subtype) logging.info('********** get_auto_buy_info ret:%s', str(ret)) buy_type = ret[0]['BUY_TYPE'] buy_money = ret[0]['BUY_MONEY'] card_id = ret[0]['CARD_ID'] if int(comsump_type) > 1: # 通过货币创建房间 card_id = 0 sql = '''insert into t_create_room_log(config_id, sub_type, owner_id, pay_type, pay_number, card_id) values(%s, %s, %s, %s, %s, %s)''' args = (config_id, int(subtype), user_id, int(comsump_type), buy_money, card_id) idx = Db.Mysql.connect('esun_texas').insert(sql, args) return idx
def check_addon_pause(match, match_id, table_id): ''' 销毁一个牌桌时检查该场比赛是否符合addon/pause 状态 日期: 2013-01-03 14:25 作者:刘立坤 目的:修复addon牌桌卡死的bug ''' pause_match = get_pause_match(match_id) #该场比赛没有处于等待addon/pause 状态 if pause_match == None: return False logging.info('check_addon_pause match[%s], table_id[%s]' % (match_id, table_id)) #所有牌桌进入addon状态 if pause_match.check_real_addon(): pause_match.addon_start_time = time.time() pause_match.real_start_addon = True pause_match.update_pause_starttime() #统一所有牌桌的暂停开始时间 match.has_addon = True #可以通知所有牌桌开始addon了吗 if pause_match.real_start_addon: for tableid in pause_match.table_dict.keys(): table = TableObject.get(tableid) if table == None: continue msg = { P.TABLE_ID: tableid, P.ADDON_START_TIME: pause_match.addon_start_time } c_sequence_id = '' # 取子序列号 event = P.TABLE_ADDON remotename = table.game_addr data = P.pack().event(event).mid(c_sequence_id).body(msg).get() Message.send(remotename, data) logging.info('Notify Game match[%s] start addon!' % match_id)
def check_addon_flag(match_list): ''' 检查处于addon状态的比赛 addon时间结束就恢复标记位 ''' for match_id in match_list: pause_match = get_pause_match(match_id) if not pause_match: logging.error('from check_addon_flag: not exist match_id[%s]' % match_id) return #只有真正触发了addon才继续check if pause_match.real_start_addon: #addon等待时间是否到达 pass_time = time.time() - pause_match.addon_start_time #等待时间已到,所有牌桌恢复标志位 if pass_time >= pause_match.addon_wait_time: for table_id in pause_match.table_dict.keys(): pause_match.table_dict[table_id]['ADDON_FLAG'] = False logging.info( 'check_addon_flag set flag = False, table[%s]' % table_id)