1
This commit is contained in:
parent
8b29369ca6
commit
24776f8e82
@ -12,3 +12,23 @@ timer = i_timer()
|
|||||||
|
|
||||||
def isOnlineEnv():
|
def isOnlineEnv():
|
||||||
return not os.getenv("SERVER_ENV");
|
return not os.getenv("SERVER_ENV");
|
||||||
|
|
||||||
|
def scanRedisKey(conn, pattern):
|
||||||
|
result = {}
|
||||||
|
cursor, keys = conn.scan(0, pattern, 1000)
|
||||||
|
while cursor != 0 or len(keys) > 0:
|
||||||
|
for key in keys:
|
||||||
|
if key in result:
|
||||||
|
result[key] += result[key]
|
||||||
|
else:
|
||||||
|
result[key] = 0
|
||||||
|
keys = []
|
||||||
|
if cursor != 0:
|
||||||
|
cursor, keys = conn.scan(cursor, pattern, 1000)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def getChannelByAccountId(account_id):
|
||||||
|
tmp_strings = account_id.split('_')
|
||||||
|
if len(tmp_strings) < 3:
|
||||||
|
return 0
|
||||||
|
return tmp_strings[0]
|
||||||
|
@ -42,6 +42,9 @@ class _App:
|
|||||||
def callAt(self, when, callback):
|
def callAt(self, when, callback):
|
||||||
tornado.ioloop.IOLoop.current().call_at(when, callback)
|
tornado.ioloop.IOLoop.current().call_at(when, callback)
|
||||||
|
|
||||||
|
def callLater(self, when, callback):
|
||||||
|
tornado.ioloop.IOLoop.current().call_later(when, callback)
|
||||||
|
|
||||||
def registerHandler(self, c, a, callback):
|
def registerHandler(self, c, a, callback):
|
||||||
self._requestHandler[c + '$' + a] = callback
|
self._requestHandler[c + '$' + a] = callback
|
||||||
|
|
||||||
|
@ -18,5 +18,8 @@ class _Timer:
|
|||||||
def callAt(self, when, callback):
|
def callAt(self, when, callback):
|
||||||
f7.app.callAt(when, callback)
|
f7.app.callAt(when, callback)
|
||||||
|
|
||||||
|
def callLater(self, when, callback):
|
||||||
|
f7.app.callLater(when, callback)
|
||||||
|
|
||||||
def instance():
|
def instance():
|
||||||
return _Timer.instance()
|
return _Timer.instance()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user