瀏覽代碼

fix: reduce the expiration time and avoid storing the original message text to decrease memory usage

master
zhayujie 1 年之前
父節點
當前提交
a786fa4b75
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      channel/wechat/wechat_channel.py

+ 2
- 2
channel/wechat/wechat_channel.py 查看文件

@@ -53,7 +53,7 @@ def _check(func):
if msgId in self.receivedMsgs:
logger.info("Wechat message {} already received, ignore".format(msgId))
return
self.receivedMsgs[msgId] = cmsg
self.receivedMsgs[msgId] = True
create_time = cmsg.create_time # 消息时间戳
if conf().get("hot_reload") == True and int(create_time) < int(time.time()) - 60: # 跳过1分钟前的历史消息
logger.debug("[WX]history message {} skipped".format(msgId))
@@ -105,7 +105,7 @@ class WechatChannel(ChatChannel):

def __init__(self):
super().__init__()
self.receivedMsgs = ExpiredDict(60 * 60 * 24)
self.receivedMsgs = ExpiredDict(60 * 60)

def startup(self):
itchat.instance.receivingRetryCount = 600 # 修改断线超时时间


Loading…
取消
儲存