Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
39a57011
Unverified
Commit
39a57011
authored
Mar 21, 2026
by
Wesley Liddick
Committed by
GitHub
Mar 21, 2026
Browse files
Merge pull request #1182 from DaydreamCoding/fix/ops-alert-wg-race-and-context-leak
fix(ops_alert): wg.Add 竞态修复 + leader lock release context 泄漏
parents
a225a241
5c39e6f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/ops_alert_evaluator_service.go
View file @
39a57011
...
...
@@ -88,6 +88,7 @@ func (s *OpsAlertEvaluatorService) Start() {
if
s
.
stopCh
==
nil
{
s
.
stopCh
=
make
(
chan
struct
{})
}
s
.
wg
.
Add
(
1
)
go
s
.
run
()
})
}
...
...
@@ -105,7 +106,6 @@ func (s *OpsAlertEvaluatorService) Stop() {
}
func
(
s
*
OpsAlertEvaluatorService
)
run
()
{
s
.
wg
.
Add
(
1
)
defer
s
.
wg
.
Done
()
// Start immediately to produce early feedback in ops dashboard.
...
...
@@ -848,7 +848,9 @@ func (s *OpsAlertEvaluatorService) tryAcquireLeaderLock(ctx context.Context, loc
return
nil
,
false
}
return
func
()
{
_
,
_
=
opsAlertEvaluatorReleaseScript
.
Run
(
ctx
,
s
.
redisClient
,
[]
string
{
key
},
s
.
instanceID
)
.
Result
()
releaseCtx
,
releaseCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Second
)
defer
releaseCancel
()
_
,
_
=
opsAlertEvaluatorReleaseScript
.
Run
(
releaseCtx
,
s
.
redisClient
,
[]
string
{
key
},
s
.
instanceID
)
.
Result
()
},
true
}
...
...
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