diff --git a/tools/rankserver/game2003rank.py b/tools/rankserver/game2003rank.py index 96d4cfe..be0a546 100644 --- a/tools/rankserver/game2003rank.py +++ b/tools/rankserver/game2003rank.py @@ -122,7 +122,7 @@ def internalDayReadMysqlData(): temp_idx = 0 while 1: cursor.execute('SELECT accountid, user_name, avatar_url, pass, cumul_coin, idx' - ' FROM user WHERE idx > %s LIMIT 0, 1000' % (last_idx)) + ' FROM user WHERE idx > %s LIMIT 0, 5000' % (last_idx)) has_data = False for row in cursor: @@ -134,10 +134,9 @@ def internalDayReadMysqlData(): temp_idx = int(row[5]) if (temp_idx > last_idx) : last_idx = int(row[5]) - + time.sleep(0.001); if not has_data: break - r = getRedis() updateRank(r, pass_list, coin_list) @@ -176,37 +175,37 @@ def readMysqlData(rushtime): last_idx = 0 temp_idx = 0 while 1: - cursor.execute('SELECT accountid, user_name, avatar_url, pass, cumul_coin, idx FROM user ' - ' WHERE idx > %s LIMIT 0, 1000' % (last_idx)) + cursor.execute('SELECT accountid, user_name, avatar_url, pass, cumul_coin, idx, modify_time FROM user ' + ' WHERE modify_time > %s AND idx > %s LIMIT 0, 1000' % (time.time() - 300, last_idx)) has_data = False for row in cursor: has_data = True - #更新击杀榜 + #更新通关榜 delRepeatData(row, pass_list) refreshData(row, pass_list) temp_idx = int(row[5]) if (temp_idx > last_idx) : last_idx = int(row[5]) + time.sleep(0.001); if not has_data: break - last_idx = 0 temp_idx = 0 while 1: - cursor.execute('SELECT accountid, user_name, avatar_url, pass, cumul_coin, idx FROM user ' - ' WHERE idx > %s LIMIT 0, 1000' % (last_idx)) + cursor.execute('SELECT accountid, user_name, avatar_url, pass, cumul_coin, idx, modify_time FROM user ' + ' WHERE modify_time > %s AND idx > %s LIMIT 0, 1000' % (time.time() - 300, last_idx)) has_data = False for row in cursor: has_data = True - #更新胜场榜 + #更新金币榜 delRepeatData(row, coin_list) refreshCoinData(row, coin_list) temp_idx = int(row[5]) if (temp_idx > last_idx) : last_idx = int(row[5]) + time.sleep(0.001); if not has_data: break - updateRank(r, pass_list, coin_list) tornado.ioloop.IOLoop.current().call_later(rushtime, lambda : readMysqlData(rushtime)