修复心跳计数bug
This commit is contained in:
parent
e6757cfc4a
commit
a8c0047bf4
11
server.py
11
server.py
@ -206,7 +206,7 @@ def load_cache():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def update_pairs(addr, ccid, clear=0,cnt=0):
|
def update_pairs(addr, ccid, clear=0,cnt=[0]):
|
||||||
"""更新终端库
|
"""更新终端库
|
||||||
addr:绑定tcp地址
|
addr:绑定tcp地址
|
||||||
ccid:终端号
|
ccid:终端号
|
||||||
@ -245,10 +245,11 @@ CCID:{ccid.decode()}
|
|||||||
clents = ' \n'+'\r\n'.join(od) if len(od) else ""
|
clents = ' \n'+'\r\n'.join(od) if len(od) else ""
|
||||||
t=f"在线终端已更新,数量{len(od)}。{clents}"
|
t=f"在线终端已更新,数量{len(od)}。{clents}"
|
||||||
logger.info(t)
|
logger.info(t)
|
||||||
cnt += 1
|
cnt[0] += 1
|
||||||
# cnt为1或为10的倍数
|
# cnt[0]是一个列表,它的默认值只会在函数定义时初始化一次,因此它的值在多次调用时保持不变
|
||||||
if cnt == 1 or cnt%10 == 0:
|
# cnt[0]为1或为10的倍数
|
||||||
cnt = 0
|
if cnt[0] == 1 or cnt[0]%10 == 0:
|
||||||
|
cnt[0] = 0
|
||||||
s2wx("","",t)
|
s2wx("","",t)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user