bug: prevent go routine leakage due to existing DeferCheck (#18558)

* bug: prevent go routine leakage due to existing DeferCheck

* add changelog
This commit is contained in:
cskh 2023-08-23 10:33:07 -04:00 committed by GitHub
parent a1cd3f8329
commit b37587bb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

3
.changelog/18558.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
check: prevent go routine leakage when existing Defercheck of same check id is not nil
```

View File

@ -838,6 +838,12 @@ func (l *State) setCheckStateLocked(c *CheckState) {
existing := l.checks[id] existing := l.checks[id]
if existing != nil { if existing != nil {
c.InSync = c.Check.IsSame(existing.Check) c.InSync = c.Check.IsSame(existing.Check)
// If the existing check has a Defercheck, it needs to be
// assigned to the new check
if existing.DeferCheck != nil && c.DeferCheck == nil {
c.DeferCheck = existing.DeferCheck
c.InSync = false
}
} }
l.checks[id] = c l.checks[id] = c