Skip to content

Commit

Permalink
fix: reduce the expiration time and avoid storing the original messag…
Browse files Browse the repository at this point in the history
…e text to decrease memory usage
  • Loading branch information
zhayujie committed Jul 21, 2023
1 parent e4c7602 commit a786fa4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions channel/wechat/wechat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def wrapper(self, cmsg: ChatMessage):
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))
Expand Down Expand Up @@ -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 # 修改断线超时时间
Expand Down

0 comments on commit a786fa4

Please sign in to comment.