This commit is contained in:
aozhiwei 2020-01-13 17:34:06 +08:00
parent be6876015b
commit 9fdfb80b20

View File

@ -61,6 +61,7 @@ def _updateRank(r, channel, pass_list):
r.set("game2003api:pass_rank_" + channel, json.dumps(pass_rank))
def fullUpdateRank():
f7.udplog.info('fullUpdateRank begin')
mysql_conf = json.loads(open(CONFIG_DIR + '/rankserver.mysql.cluster.json', 'r').read())
rank_hash = {}
for conf in mysql_conf:
@ -92,6 +93,7 @@ def fullUpdateRank():
r = _getRedis()
for channel in rank_hash:
_updateRank(r, channel, rank_hash[channel])
f7.udplog.info('fullUpdateRank end')
#每日定时读取mysql里的数据生成排行榜写入redis后php读取redis返回客户端显示
def _fullUpdateRank(rushtime):
@ -101,6 +103,7 @@ def _fullUpdateRank(rushtime):
f7.app.createAsyncTask(done_callback, fullUpdateRank, ())
def incrementUpdateRank(rushtime):
f7.udplog.info('incrementUpdateRank begin')
mysql_conf = json.loads(open(CONFIG_DIR + '/rankserver.mysql.cluster.json', 'r').read())
r = _getRedis()
rank_hash = {}
@ -137,6 +140,7 @@ def incrementUpdateRank(rushtime):
for channel in rank_hash:
_updateRank(r, channel, rank_hash[channel])
f7.udplog.info('incrementUpdateRank end')
#每5分钟读取mysql里发生改变过的数据更新排行榜
def _incrementUpdateRank(rushtime):
@ -146,6 +150,7 @@ def _incrementUpdateRank(rushtime):
f7.app.createAsyncTask(done_callback, incrementUpdateRank, ())
if __name__ == "__main__":
q7.xPrint('pid %d' % os.getpid())
f7.app.init('/data/logs/game2003_rankserver/logs')
f7.udplog.info('rankserver start pid:' + str(os.getpid()))