代码优化
This commit is contained in:
parent
7d4ed53a59
commit
ef79c45d78
|
|
@ -6,13 +6,13 @@ import os
|
||||||
bind = "0.0.0.0:8012"
|
bind = "0.0.0.0:8012"
|
||||||
|
|
||||||
# 工作进程数
|
# 工作进程数
|
||||||
workers = multiprocessing.cpu_count() * 2 + 1
|
workers = 3
|
||||||
|
|
||||||
# 工作进程类型
|
# 工作进程类型
|
||||||
worker_class = "uvicorn.workers.UvicornWorker"
|
worker_class = "uvicorn.workers.UvicornWorker"
|
||||||
|
|
||||||
# 工作进程超时时间
|
# 工作进程超时时间
|
||||||
timeout = 120
|
timeout = 600
|
||||||
|
|
||||||
# 保持连接
|
# 保持连接
|
||||||
keepalive = 5
|
keepalive = 5
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,7 @@ class DealAllTask:
|
||||||
payload = {"padCodes": pad_code, "realIphoneTemplateId": 37}
|
payload = {"padCodes": pad_code, "realIphoneTemplateId": 37}
|
||||||
return self.send_post_get(api_endpoint, payload)
|
return self.send_post_get(api_endpoint, payload)
|
||||||
|
|
||||||
|
def set_network_proxy(self, pad_code: list[str], country: str, proxy_platform="kkoip"):
|
||||||
def set_network_proxy(self,pad_code: list[str], country: str, proxy_platform="kkoip"):
|
|
||||||
if proxy_platform == "kkoip":
|
if proxy_platform == "kkoip":
|
||||||
self.logger.info(f"{pad_code}使用kkoip")
|
self.logger.info(f"{pad_code}使用kkoip")
|
||||||
set_network_proxy(pad_codes=pad_code, account='6255452-2ff229fb',
|
set_network_proxy(pad_codes=pad_code, account='6255452-2ff229fb',
|
||||||
|
|
@ -139,7 +138,9 @@ class DealAllTask:
|
||||||
|
|
||||||
def check_phone_status(self, pad_code: list[str], file_name: str, times=10):
|
def check_phone_status(self, pad_code: list[str], file_name: str, times=10):
|
||||||
count = 0
|
count = 0
|
||||||
|
self.logger.info(f"{pad_code};{file_name},开始等待180秒")
|
||||||
time.sleep(180)
|
time.sleep(180)
|
||||||
|
self.logger.info(f"{pad_code};{file_name},等待180秒结束")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
result = self.async_execute_adb_command(pad_code, file_name, is_check=True)
|
result = self.async_execute_adb_command(pad_code, file_name, is_check=True)
|
||||||
|
|
@ -220,10 +221,10 @@ class DealAllTask:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
# if __name__ == '__main__':
|
||||||
obj = DealAllTask()
|
# obj = DealAllTask()
|
||||||
results = obj.async_execute_adb_command(["ACP251024MKBZTCO"], "test_abc.js", is_check=True)
|
# results = obj.async_execute_adb_command(["ACP251024MKBZTCO"], "test_abc.js", is_check=True)
|
||||||
self.logger.info(type(results))
|
# self.logger.info(type(results))
|
||||||
if results:
|
# if results:
|
||||||
self.logger.info(123113)
|
# self.logger.info(123113)
|
||||||
self.logger.info(f"1223{results}1223")
|
# self.logger.info(f"1223{results}1223")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue