fix: context leak with replication endpoint hearbeat (#15721)

This commit is contained in:
jiuker 2022-09-21 18:08:45 +08:00 committed by GitHub
parent b2a67834ac
commit 749ce107ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,7 +108,6 @@ func (sys *BucketTargetSys) heartBeat(ctx context.Context) {
if len(eps) > 0 {
cctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
m := map[string]epHealth{}
for result := range sys.hcClient.Alive(cctx, madmin.AliveOpts{}, eps...) {
var online bool
@ -121,6 +120,7 @@ func (sys *BucketTargetSys) heartBeat(ctx context.Context) {
Online: online,
}
}
cancel()
sys.hMutex.Lock()
sys.hc = m
sys.hMutex.Unlock()