Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tardis.
dr_py
提交
f89eaa07
dr_py
项目概览
Tardis.
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
dr_py
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f89eaa07
编写于
11月 21, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复drpy聚搜线程池内不支持环境变量的bug
上级
17d679c9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
18 addition
and
7 deletion
+18
-7
base/rules.db
base/rules.db
+0
-0
controllers/vod.py
controllers/vod.py
+17
-6
js/version.txt
js/version.txt
+1
-1
未找到文件。
base/rules.db
浏览文件 @
f89eaa07
无法预览此类型文件
controllers/vod.py
浏览文件 @
f89eaa07
...
...
@@ -5,7 +5,7 @@
# Date : 2022/9/6
import
json
from
flask
import
Blueprint
,
abort
,
request
,
render_template
,
render_template_string
,
jsonify
,
make_response
,
redirect
from
flask
import
Blueprint
,
abort
,
request
,
render_template
,
render_template_string
,
jsonify
,
make_response
,
redirect
,
current_app
from
time
import
time
from
utils.web
import
getParmas
,
get_interval
from
utils.cfg
import
cfg
...
...
@@ -46,7 +46,7 @@ def search_one_py(rule, wd, before: str = ''):
print
(
f
'
{
rule
}
发生错误:
{
e
}
'
)
return
None
def
search_one
(
rule
,
wd
,
before
:
str
=
''
):
def
search_one
(
rule
,
wd
,
before
:
str
=
''
,
env
:
dict
=
None
,
app
=
None
):
t1
=
time
()
if
not
before
:
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
...
...
@@ -57,9 +57,12 @@ def search_one(rule, wd, before: str = ''):
try
:
with
open
(
js_path
,
encoding
=
'utf-8'
)
as
f2
:
jscode
=
f2
.
read
()
env
=
get_env
()
if
env
:
# 渲染字符串文本 render_template_string 必须带 flask的上下文
with
app
.
app_context
():
jscode
=
render_template_string
(
jscode
,
**
env
)
# if '007' in rule:
# print(rule,jscode)
jscode
=
before
+
jscode
+
end_code
# print(jscode)
ctx
.
eval
(
jscode
)
...
...
@@ -139,8 +142,14 @@ def merged_hide(merged_rules):
logger
.
info
(
f
'数据库筛选隐藏规则耗时
{
get_interval
(
t1
)
}
毫秒,共计
{
all_cnt
}
条规则,隐藏后可渲染
{
len
(
merged_rules
)
}
条规则'
)
return
merged_rules
def
disable_exit_for_threadpool_executor
():
import
atexit
import
concurrent.futures
atexit
.
unregister
(
concurrent
.
futures
.
thread
.
_python_exit
)
def
multi_search
(
wd
):
lsg
=
storage_service
()
env
=
get_env
()
t1
=
time
()
try
:
timeout
=
round
(
int
(
lsg
.
getItem
(
'SEARCH_TIMEOUT'
,
5000
))
/
1000
,
2
)
...
...
@@ -167,7 +176,7 @@ def multi_search(wd):
with
ThreadPoolExecutor
(
max_workers
=
len
(
search_sites
))
as
executor
:
to_do
=
[]
for
site
in
search_sites
:
future
=
executor
.
submit
(
search_one
,
site
,
wd
,
before
)
future
=
executor
.
submit
(
search_one
,
site
,
wd
,
before
,
env
,
current_app
.
_get_current_object
()
)
to_do
.
append
(
future
)
try
:
for
future
in
as_completed
(
to_do
,
timeout
=
timeout
):
# 并发执行
...
...
@@ -180,6 +189,8 @@ def multi_search(wd):
import
atexit
atexit
.
unregister
(
thread
.
_python_exit
)
executor
.
shutdown
=
lambda
wait
:
None
# disable_exit_for_threadpool_executor()
logger
.
info
(
f
'drpy聚搜
{
len
(
search_sites
)
}
个源共计耗时
{
get_interval
(
t1
)
}
毫秒'
)
return
jsonify
({
"list"
:
res
...
...
@@ -323,7 +334,7 @@ def vod_home():
return
jsonify
(
data
)
if
wd
:
# 搜索
if
rule
==
'drpy'
:
#
print(f'准备单独处理聚合搜索:{wd}')
print
(
f
'准备单独处理聚合搜索:
{
wd
}
'
)
return
multi_search
(
wd
)
# return multi_search2(wd)
else
:
...
...
js/version.txt
浏览文件 @
f89eaa07
3.9.22beta1
\ No newline at end of file
3.9.22beta2
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录