diff --git a/server.py b/server.py index 5d1030e..1676453 100755 --- a/server.py +++ b/server.py @@ -55,6 +55,7 @@ _{datetime.datetime.now()}_ Timer(10,s2wx).start() return pushisbusy=1 + le = len(msgcache) def send(): c= " \n".join(msgcache[:3]) res = requests.post("http://push.nmhd.eu.org:12722/push/murmur", json={ @@ -80,21 +81,16 @@ _{datetime.datetime.now()}_ # else: # return res["message"] - if len(msgcache) >3: + if le >2: send() - if len(msgcache): - msgcache.pop(0) - if len(msgcache): - msgcache.pop(0) - if len(msgcache): - msgcache.pop(0) + msgcache.pop(0) + msgcache.pop(0) + msgcache.pop(0) Timer(10,s2wx).start() - elif (not len(content)) and len(msgcache): + elif (not len(content)) and le: # 等效超时 send() - if len(msgcache): - msgcache.pop(0) - if len(msgcache): + for i in le: msgcache.pop(0) Timer(10,s2wx).start() pushisbusy=0