Browse Source

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

master
zhayujie 1 year ago
parent
commit
a786fa4b75
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      channel/wechat/wechat_channel.py

+ 2
- 2
channel/wechat/wechat_channel.py View File

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


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


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


Loading…
Cancel
Save