fix: refactor background heal for cluster health (#10225)

This commit is contained in:
Harshavardhana
2020-08-07 19:43:06 -07:00
committed by GitHub
parent 8049184dcc
commit 2a9819aff8
9 changed files with 91 additions and 70 deletions

View File

@@ -112,11 +112,11 @@ func (ahs *allHealState) getHealLocalDisks() []Endpoints {
return healLocalDisks
}
func (ahs *allHealState) updateHealLocalDisks(eps []Endpoints) {
func (ahs *allHealState) updateHealLocalDisks(healLocalDisks []Endpoints) {
ahs.Lock()
defer ahs.Unlock()
ahs.healLocalDisks = eps
ahs.healLocalDisks = healLocalDisks
}
func (ahs *allHealState) periodicHealSeqsClean(ctx context.Context) {
@@ -502,6 +502,10 @@ func (h *healSequence) isQuitting() bool {
// check if the heal sequence has ended
func (h *healSequence) hasEnded() bool {
h.mutex.RLock()
// background heal never ends
if h.clientToken == bgHealingUUID {
return false
}
ended := len(h.currentStatus.Items) == 0 || h.currentStatus.Summary == healStoppedStatus || h.currentStatus.Summary == healFinishedStatus
h.mutex.RUnlock()
return ended