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