Skip to content

Commit

Permalink
Revert "修复py3.8+(含3.9,3.10)版本中,监听配置会报错Not Serializable的问题(非windows环境下…
Browse files Browse the repository at this point in the history
…,RLock改用mulitprocessing库的RLock. 同时,把callback_tread_pool和process_mgr标记为transient,因为没有序列化的必要)"

This reverts commit 05e30aa.
  • Loading branch information
runzhi214 committed Dec 1, 2022
1 parent 05e30aa commit 63d37a7
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions nacos/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from multiprocessing import Process, Manager, Queue, pool
from threading import RLock, Thread
from multiprocessing import RLock as PRLock

try:
# python3.6
Expand Down Expand Up @@ -252,19 +251,13 @@ def __init__(self, server_addresses, endpoint=None, namespace=None, ak=None, sk=
self.username = username
self.password = password

if platform.system() == "windows":
self.server_list_lock = RLock()
else:
self.server_list_lock = PRLock()
self.server_list_lock = RLock()
self.server_offset = 0

self.watcher_mapping = dict()
self.subscribed_local_manager = SubscribedLocalManager()
self.subscribe_timer_manager = NacosTimerManager()
if platform.system() == "windows":
self.pulling_lock = RLock()
else:
self.pulling_lock = PRLock()
self.pulling_lock = RLock()
self.puller_mapping = None
self.notify_queue = None
self.callback_tread_pool = None
Expand Down Expand Up @@ -1170,17 +1163,6 @@ def stop_subscribe(self):
"""
self.subscribe_timer_manager.stop()

def __getstate__(self):
self_dict = self.__dict__.copy()
# pool object cannot be passed and there is no need to
del self_dict['callback_tread_pool']
# weak-ref object cannot be pickled and there is no need to
del self_dict['process_mgr']
return self_dict

def __setstate__(self, state):
self.__dict__.update(state)


if DEBUG:
NacosClient.set_debugging()

0 comments on commit 63d37a7

Please sign in to comment.