xtn-tools-pro 1.0.0.7.7__py3-none-any.whl → 1.0.0.7.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xtn_tools_pro/task_pro/go_fun_v3.py +29 -6
- {xtn_tools_pro-1.0.0.7.7.dist-info → xtn_tools_pro-1.0.0.7.9.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.0.7.7.dist-info → xtn_tools_pro-1.0.0.7.9.dist-info}/RECORD +6 -6
- {xtn_tools_pro-1.0.0.7.7.dist-info → xtn_tools_pro-1.0.0.7.9.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.0.7.7.dist-info → xtn_tools_pro-1.0.0.7.9.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.0.7.7.dist-info → xtn_tools_pro-1.0.0.7.9.dist-info}/top_level.txt +0 -0
@@ -33,11 +33,12 @@ class GoFunTaskV3:
|
|
33
33
|
processes_num = ini_dict.get('processes_num', 0) # 进程数
|
34
34
|
thread_num = ini_dict.get('thread_num', 0) # 线程数
|
35
35
|
restart_time = ini_dict.get('restart_time', 0) # 间隔x秒强制重启
|
36
|
-
restart_time =
|
36
|
+
restart_time = 60 * 60 if restart_time <= 0 else restart_time # 间隔x秒强制重启时间不传默认60分钟
|
37
37
|
update_proxies_time = ini_dict.get('update_proxies_time', 0) # 间隔x秒更新代理
|
38
38
|
upload_task_time = ini_dict.get('upload_task_time', 0) # 回写间隔
|
39
|
-
download_not_task_time = ini_dict.get('download_not_task_time', 0) # 当遇到下载任务接口返回空任务时,间隔x
|
40
|
-
|
39
|
+
download_not_task_time = ini_dict.get('download_not_task_time', 0) # 当遇到下载任务接口返回空任务时,间隔x秒再继续请求
|
40
|
+
download_task_qsize = ini_dict.get('download_task_qsize', 10) # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
41
|
+
download_task_qsize = 10 if download_task_qsize < 0 else download_task_qsize # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
41
42
|
|
42
43
|
# 默认进程数和线程数
|
43
44
|
processes_num = 1 if processes_num <= 0 else processes_num
|
@@ -72,6 +73,7 @@ class GoFunTaskV3:
|
|
72
73
|
"update_proxy_url": update_proxy_url, # 更新代理地址
|
73
74
|
"external_ip": external_ip,
|
74
75
|
"download_not_task_time": download_not_task_time,
|
76
|
+
"download_task_qsize": download_task_qsize,
|
75
77
|
}
|
76
78
|
|
77
79
|
logger.debug(
|
@@ -152,7 +154,8 @@ class GoFunTaskV3:
|
|
152
154
|
logger.info("检测到已达强制重启间隔,正在重启...")
|
153
155
|
self.manager_info["gofun_kill_status"] = True
|
154
156
|
|
155
|
-
logger.info(
|
157
|
+
logger.info(
|
158
|
+
f"主线程正常...进程数:{len(go_process_list)}...gofun(True不存在|False正常):{self.manager_info['gofun_kill_status']}")
|
156
159
|
time.sleep(10)
|
157
160
|
|
158
161
|
def __get_external_ip(self):
|
@@ -179,15 +182,16 @@ class GoFunTaskV3:
|
|
179
182
|
auto = ini_info["auto"]
|
180
183
|
task = ini_info["task"]
|
181
184
|
download_not_task_time = ini_info["download_not_task_time"]
|
185
|
+
download_task_qsize = ini_info["download_task_qsize"]
|
182
186
|
headers = {"Authorization": auto}
|
183
187
|
params = {"taskType": task}
|
184
|
-
|
188
|
+
logger.warning("下载队列启动成功...")
|
185
189
|
download_queue_exist_cnt = 3
|
186
190
|
while True:
|
187
191
|
try:
|
188
192
|
qsize = download_queue.qsize()
|
189
193
|
logger.info(f"当前队列剩余任务数:{qsize}")
|
190
|
-
if qsize
|
194
|
+
if qsize > download_task_qsize:
|
191
195
|
time.sleep(download_not_task_time)
|
192
196
|
continue
|
193
197
|
resp = requests.get(download_url, headers=headers, params=params, timeout=5)
|
@@ -227,6 +231,7 @@ class GoFunTaskV3:
|
|
227
231
|
upload_task_time = ini_info["upload_task_time"]
|
228
232
|
headers = {"Authorization": auto}
|
229
233
|
params = {"taskType": task}
|
234
|
+
logger.warning("回写队列启动成功...")
|
230
235
|
while True:
|
231
236
|
# 判断队列是否有值
|
232
237
|
empty = upload_queue.empty()
|
@@ -363,3 +368,21 @@ class GoFunTaskV3:
|
|
363
368
|
except Exception as e:
|
364
369
|
self.logger.critical(f"update_upload_task 更新任务 {self.upload_queue, task_item} 报错 {e}")
|
365
370
|
return False
|
371
|
+
|
372
|
+
def help(self):
|
373
|
+
help_txt = """
|
374
|
+
参数说明:
|
375
|
+
host:必填,域名
|
376
|
+
port:选填,端口
|
377
|
+
task:必填,任务类型
|
378
|
+
auto:必填,token
|
379
|
+
proxies_dict:选填,默认为空,为空时会启动获取代理接口获取代理,不为空时则不启动该接口而是一直使用用户传递过来的代理
|
380
|
+
update_proxies_time:选填,默认为0,间隔x秒更新代理,0则每次启动时获取一次之后就不在请求代理接口
|
381
|
+
processes_num:选填,进程数,默认1
|
382
|
+
thread_num:选填,线程数,默认1
|
383
|
+
restart_time:选填,间隔x秒强制重启,默认60分钟
|
384
|
+
upload_task_time:选填,回写间隔,默认0
|
385
|
+
download_not_task_time:选填,默认0,当遇到下载任务接口返回空任务时,间隔x秒再继续请求
|
386
|
+
download_task_qsize:选填,默认10,触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
387
|
+
"""
|
388
|
+
self.logger.info(help_txt)
|
@@ -12,7 +12,7 @@ xtn_tools_pro/proxy/proxy.py,sha256=No6E1pFY5yx2F4976pXPrLtq-QEVp79KupzcufjSN58,
|
|
12
12
|
xtn_tools_pro/task_pro/__init__.py,sha256=nK3U47hWwE1H875ieEToH9r-jzXHS-PXk8cDstOvRE8,418
|
13
13
|
xtn_tools_pro/task_pro/go_fun.py,sha256=hWEt2uJ9FCvJH7PhVZttS-11A7J6zbRKwX7c5YLYQag,19144
|
14
14
|
xtn_tools_pro/task_pro/go_fun_v2.py,sha256=SgcXgtEBGSVL1V2LyqO0z8Md2H8JZxucYrLLIwqtiLM,18489
|
15
|
-
xtn_tools_pro/task_pro/go_fun_v3.py,sha256=
|
15
|
+
xtn_tools_pro/task_pro/go_fun_v3.py,sha256=PdmT59wTJYS3gYS8d3LQX8JvQcREqfZENiy3MARb0UY,17991
|
16
16
|
xtn_tools_pro/utils/__init__.py,sha256=I1_n_NP23F2lBqlF4EOlnOdLYxM8M4pbn63UhJN1hRE,418
|
17
17
|
xtn_tools_pro/utils/crypto.py,sha256=oyzFqWum_oimUtzhfVCELQhdMjxDbLu-nOWfcNmazcc,4087
|
18
18
|
xtn_tools_pro/utils/file_utils.py,sha256=obaBP7CaBCsXxzqGeWzV2l0yw7vicgKOaXzmpMV8ips,2567
|
@@ -22,8 +22,8 @@ xtn_tools_pro/utils/retry.py,sha256=0wjHsR5DBBKpv4naMfxiky8kprrZes4WURIfFQ4H708,
|
|
22
22
|
xtn_tools_pro/utils/set_data.py,sha256=IthfAclck7AbaxOIKOgJZ2wdcfEmlvC-C63Tywcr4bA,11180
|
23
23
|
xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
|
24
24
|
xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
|
25
|
-
xtn_tools_pro-1.0.0.7.
|
26
|
-
xtn_tools_pro-1.0.0.7.
|
27
|
-
xtn_tools_pro-1.0.0.7.
|
28
|
-
xtn_tools_pro-1.0.0.7.
|
29
|
-
xtn_tools_pro-1.0.0.7.
|
25
|
+
xtn_tools_pro-1.0.0.7.9.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
+
xtn_tools_pro-1.0.0.7.9.dist-info/METADATA,sha256=X30KRk9z0_T_1uZZ3gTO0TE6llEGV1pI6zsUhQTU2VQ,498
|
27
|
+
xtn_tools_pro-1.0.0.7.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
28
|
+
xtn_tools_pro-1.0.0.7.9.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
29
|
+
xtn_tools_pro-1.0.0.7.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|