作者 陈俊学

增加change线程锁

... ... @@ -4,5 +4,5 @@ SERVER:
reconnect_interval: 3
VERSION:
code: 90
name: 2.0.0
\ No newline at end of file
code: 91
name: 2.0.1
\ No newline at end of file
... ...
... ... @@ -49,6 +49,7 @@ class Monitor(callback.CallBack):
self.executor = ThreadPoolExecutor(100, 'task_thread')
self.init_config = {}
self.queue = None
self.changeLock = threading.Lock()
def bind(self):
models.Config.set('host', Client.target_server)
... ... @@ -85,6 +86,8 @@ class Monitor(callback.CallBack):
return client.info()
else:
try:
self.onChangEnv(email, 'waiting', '排队中')
self.changeLock.acquire(timeout=120) # 设置超时释放时间为120秒
self.changeingIn(email) # 转环境的话清理缓存
result, email, password, cookie, user_agent = self.selenium_login(email, password, cookie)
if result:
... ... @@ -93,6 +96,8 @@ class Monitor(callback.CallBack):
except Exception as err:
self.onChangEnv(email, 'changeError', str(err))
raise err
finally:
self.changeLock.release()
def login(self, email, password, cookie=None, user_agent=None, proxy=None):
limit = 100
... ...
... ... @@ -69,7 +69,7 @@ else
echo "" >log/fbchat.log
python3 setup.py #安装依赖库
echo '安装Socket5代理'
# echo '安装Socket5代理'
# wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O install_proxy.sh
# bash install_proxy.sh --port=59395 --user=ntkj --passwd=nantian888
if [ ! -d /home/project/facebookchat/db/versions ]; then
... ...