Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b23416bb
authored
Jun 10, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔧
fix(channel-test): ensure proper state reset to prevent deadlocks
parent
92de4d0d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
controller/channel-test.go
+8
-3
No files found.
controller/channel-test.go
View file @
b23416bb
...
@@ -271,6 +271,13 @@ func testAllChannels(notify bool) error {
...
@@ -271,6 +271,13 @@ func testAllChannels(notify bool) error {
disableThreshold
=
10000000
// a impossible value
disableThreshold
=
10000000
// a impossible value
}
}
gopool
.
Go
(
func
()
{
gopool
.
Go
(
func
()
{
// 使用 defer 确保无论如何都会重置运行状态,防止死锁
defer
func
()
{
testAllChannelsLock
.
Lock
()
testAllChannelsRunning
=
false
testAllChannelsLock
.
Unlock
()
}()
for
_
,
channel
:=
range
channels
{
for
_
,
channel
:=
range
channels
{
isChannelEnabled
:=
channel
.
Status
==
common
.
ChannelStatusEnabled
isChannelEnabled
:=
channel
.
Status
==
common
.
ChannelStatusEnabled
tik
:=
time
.
Now
()
tik
:=
time
.
Now
()
...
@@ -305,9 +312,7 @@ func testAllChannels(notify bool) error {
...
@@ -305,9 +312,7 @@ func testAllChannels(notify bool) error {
channel
.
UpdateResponseTime
(
milliseconds
)
channel
.
UpdateResponseTime
(
milliseconds
)
time
.
Sleep
(
common
.
RequestInterval
)
time
.
Sleep
(
common
.
RequestInterval
)
}
}
testAllChannelsLock
.
Lock
()
testAllChannelsRunning
=
false
testAllChannelsLock
.
Unlock
()
if
notify
{
if
notify
{
service
.
NotifyRootUser
(
dto
.
NotifyTypeChannelTest
,
"通道测试完成"
,
"所有通道测试已完成"
)
service
.
NotifyRootUser
(
dto
.
NotifyTypeChannelTest
,
"通道测试完成"
,
"所有通道测试已完成"
)
}
}
...
...
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