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
bff03e4d
Commit
bff03e4d
authored
Jul 16, 2025
by
baiquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(service): 优化关闭浏览器逻辑
- 将关闭浏览器的逻辑包裹在 try-except块中,提高异常处理的健壮性
parent
4a8724ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
service/hub_.py
+10
-10
No files found.
service/hub_.py
View file @
bff03e4d
...
@@ -99,16 +99,16 @@ async def closeBrowser(browser_id):
...
@@ -99,16 +99,16 @@ async def closeBrowser(browser_id):
data
=
{
data
=
{
'containerCode'
:
browser_id
,
'containerCode'
:
browser_id
,
}
}
browser_status
=
await
checkBrowserStatus
(
browser_id
)
try
:
browser_status_data
=
browser_status
.
get
(
'data'
,
{}
)
browser_status
=
await
checkBrowserStatus
(
browser_id
)
if
browser_status_data
:
browser_status_data
=
browser_status
.
get
(
'data'
,
{})
containers
=
browser_status_data
.
get
(
'containers'
,
{})
if
browser_status_data
:
if
containers
:
containers
=
browser_status_data
.
get
(
'containers'
,
{})
try
:
if
containers
:
if
(
containers
[
0
][
'status'
]
==
1
or
containers
[
0
][
'status'
]
==
0
)
and
containers
[
0
][
'containerCode'
]
==
browser_id
:
if
(
containers
[
0
][
'status'
]
==
1
or
containers
[
0
][
'status'
]
==
0
)
and
containers
[
0
][
'containerCode'
]
==
browser_id
:
return
await
sendRequest
(
"POST"
,
url
=
url
,
json_data
=
data
)
return
await
sendRequest
(
"POST"
,
url
=
url
,
json_data
=
data
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"关闭浏览器异常-->{e}"
)
logger
.
error
(
f
"关闭浏览器异常-->{e}"
)
async
def
checkBrowserStatus
(
browser_id
:
str
=
""
):
async
def
checkBrowserStatus
(
browser_id
:
str
=
""
):
"""
"""
...
...
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