Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
doudian-py
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiquan
doudian-py
Commits
94d0b3b8
Commit
94d0b3b8
authored
Jul 15, 2025
by
baiquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化hub浏览器关闭逻辑
parent
8d390169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
service/page_login.py
+2
-3
shop.py
+3
-2
No files found.
service/page_login.py
View file @
94d0b3b8
...
@@ -42,12 +42,11 @@ async def page_login(browser_id):
...
@@ -42,12 +42,11 @@ async def page_login(browser_id):
if
chromium
.
states
.
is_existed
:
if
chromium
.
states
.
is_existed
:
break
break
else
:
else
:
logger
.
error
(
f
'非Hub浏览器-->重试启动浏览器:{open_count}'
)
tab
.
close
()
tab
.
close
()
await
closeBrowser
(
browser_id
)
raise
Exception
(
f
'非Hub浏览器-->重试启动浏览器:{open_count}'
)
time
.
sleep
(
3
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"{browser_id}启动浏览器错误-->{e}"
)
logger
.
error
(
f
"{browser_id}启动浏览器错误-->{e}"
)
await
closeBrowser
(
browser_id
)
time
.
sleep
(
3
)
time
.
sleep
(
3
)
if
open_count
==
0
:
if
open_count
==
0
:
raise
AppError
(
f
"{browser_id}-->启动浏览器失败"
)
raise
AppError
(
f
"{browser_id}-->启动浏览器失败"
)
...
...
shop.py
View file @
94d0b3b8
...
@@ -144,8 +144,6 @@ async def handle_task(task):
...
@@ -144,8 +144,6 @@ async def handle_task(task):
logger
.
error
(
f
"同步店铺任务超时: {task}"
)
logger
.
error
(
f
"同步店铺任务超时: {task}"
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"同步店铺任务异常: {e}"
)
logger
.
error
(
f
"同步店铺任务异常: {e}"
)
finally
:
await
closeAllBrowser
()
elif
type_
==
2
:
elif
type_
==
2
:
# 上传图片和视频任务 - 使用线程池执行
# 上传图片和视频任务 - 使用线程池执行
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
INNER_MAX_WORKERS
)
as
inner_executor
:
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
INNER_MAX_WORKERS
)
as
inner_executor
:
...
@@ -202,6 +200,9 @@ async def run():
...
@@ -202,6 +200,9 @@ async def run():
future
.
result
()
future
.
result
()
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"任务处理异常: {e}"
)
logger
.
error
(
f
"任务处理异常: {e}"
)
for
task
in
tasks
:
if
task
.
get
(
"type"
)
==
1
:
await
closeAllBrowser
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment