Catch a few edge cases in stream allocator. (#532)

* Catch a few edge cases in stream allocator.

- More useful logging

* fire probe cluster done callback only when there is an active cluster
This commit is contained in:
Raja Subramanian
2022-03-18 20:42:15 +05:30
committed by GitHub
parent 3ce4010e89
commit d738424173
3 changed files with 48 additions and 23 deletions
+3 -1
View File
@@ -149,11 +149,13 @@ func (p *Prober) IsRunning() bool {
}
func (p *Prober) Reset() {
reset := false
var info ProbeClusterInfo
p.clustersMu.Lock()
if p.activeCluster != nil {
p.logger.Debugw("resetting active cluster", "cluster", p.activeCluster.String())
reset = true
info = p.activeCluster.GetInfo()
}
@@ -161,7 +163,7 @@ func (p *Prober) Reset() {
p.activeCluster = nil
p.clustersMu.Unlock()
if p.onProbeClusterDone != nil && info.BytesSent != 0 {
if p.onProbeClusterDone != nil && reset {
p.onProbeClusterDone(info)
}
}