@@ -204,7 +204,7 @@ def background_wxchat_thread(): | |||||
lock_identifier = str(time.time()) # 使用时间戳作为唯一标识 | lock_identifier = str(time.time()) # 使用时间戳作为唯一标识 | ||||
# 尝试获取分布式锁 | # 尝试获取分布式锁 | ||||
if redis_helper.redis_helper.acquire_lock(lock_name, timeout=60): | |||||
if redis_helper.redis_helper.acquire_lock(lock_name, timeout=10): | |||||
try: | try: | ||||
logger.info("分布式锁已成功获取") | logger.info("分布式锁已成功获取") | ||||
# 启动任务 | # 启动任务 | ||||
@@ -460,7 +460,7 @@ class WechatThreadManager: | |||||
def sync_contacts_threads_processer(self,wxid, token_id, app_id): | def sync_contacts_threads_processer(self,wxid, token_id, app_id): | ||||
ret,msg,contacts_list = self.wxchat.fetch_contacts_list(token_id, app_id) | ret,msg,contacts_list = self.wxchat.fetch_contacts_list(token_id, app_id) | ||||
if ret==200: | if ret==200: | ||||
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong']] # 可以调整截取范围 | |||||
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong','tmessage']] # 可以调整截取范围 | |||||
print(f'{wxid}的好友数量 {len(friend_wxids)}') | print(f'{wxid}的好友数量 {len(friend_wxids)}') | ||||
cache=self.wxchat.get_contacts_brief_from_cache(wxid) | cache=self.wxchat.get_contacts_brief_from_cache(wxid) | ||||
cache_wxids = [c.get('userName') for c in cache] | cache_wxids = [c.get('userName') for c in cache] | ||||
@@ -107,8 +107,6 @@ class GetLoginWxQRCodeResource(Resource): | |||||
return jsonify(data) | return jsonify(data) | ||||
def waitting_login_result(wxchat:gewe_chat.GeWeChatCom, token_id, app_id,region_id, agent_token_id,hash_key, uuid,start_time): | def waitting_login_result(wxchat:gewe_chat.GeWeChatCom, token_id, app_id,region_id, agent_token_id,hash_key, uuid,start_time): | ||||
agent_tel=hash_key.split(":")[-1] | agent_tel=hash_key.split(":")[-1] | ||||
try: | try: | ||||
@@ -18,7 +18,7 @@ from voice import audio_convert | |||||
timeout_duration = 8.0 | timeout_duration = 8.0 | ||||
WX_BACKLIST=['fmessage', 'medianote','weixin','weixingongzhong'] | |||||
WX_BACKLIST=['fmessage', 'medianote','weixin','weixingongzhong','tmessage'] | |||||
class MessagesResource(Resource): | class MessagesResource(Resource): | ||||
def __init__(self): | def __init__(self): | ||||
self.parser = reqparse.RequestParser() | self.parser = reqparse.RequestParser() | ||||
@@ -386,6 +386,7 @@ def handle_text(token_id,app_id, wxid,msg_data,from_wxid, to_wxid): | |||||
timeout_duration, | timeout_duration, | ||||
lambda:check_timeout(task_thread, token_id, wxid,app_id, callback_to_user) | lambda:check_timeout(task_thread, token_id, wxid,app_id, callback_to_user) | ||||
) | ) | ||||
timeout_timer.daemon=True | |||||
timeout_timer.start() | timeout_timer.start() | ||||
# 等待任务线程完成 | # 等待任务线程完成 | ||||
@@ -937,7 +938,7 @@ def handle_mod_contacts(token_id,app_id,wxid,msg_data): | |||||
#friend_wxids.remove('fmessage') | #friend_wxids.remove('fmessage') | ||||
#friend_wxids.remove('weixin') | #friend_wxids.remove('weixin') | ||||
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong']] # 可以调整截取范围 | |||||
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong','tmessage']] # 可以调整截取范围 | |||||
print(f'{wxid}的好友数量 {len(friend_wxids)}') | print(f'{wxid}的好友数量 {len(friend_wxids)}') | ||||
gewe_chat.wxchat.save_contacts_brief_to_cache(token_id, app_id, wxid, friend_wxids) | gewe_chat.wxchat.save_contacts_brief_to_cache(token_id, app_id, wxid, friend_wxids) | ||||