aboutsummaryrefslogtreecommitdiff
path: root/go/topology/topology_event_handling.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2014-02-09 23:37:29 -0800
committerChris Lu <chris.lu@gmail.com>2014-02-09 23:37:29 -0800
commitef4c2c0d1e5bb45a63cde703013871daa401d1ef (patch)
tree5217143c909c32031278d9713bf06c82ee4b6fd1 /go/topology/topology_event_handling.go
parent67125688edc99067cb711048771de1338136e611 (diff)
downloadseaweedfs-ef4c2c0d1e5bb45a63cde703013871daa401d1ef.tar.xz
seaweedfs-ef4c2c0d1e5bb45a63cde703013871daa401d1ef.zip
cleaner cluster messages
Diffstat (limited to 'go/topology/topology_event_handling.go')
-rw-r--r--go/topology/topology_event_handling.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/go/topology/topology_event_handling.go b/go/topology/topology_event_handling.go
index 7f81d8184..5097e9874 100644
--- a/go/topology/topology_event_handling.go
+++ b/go/topology/topology_event_handling.go
@@ -10,15 +10,19 @@ import (
func (t *Topology) StartRefreshWritableVolumes(garbageThreshold string) {
go func() {
for {
- freshThreshHold := time.Now().Unix() - 3*t.pulse //3 times of sleep interval
- t.CollectDeadNodeAndFullVolumes(freshThreshHold, t.volumeSizeLimit)
+ if t.IsLeader {
+ freshThreshHold := time.Now().Unix() - 3*t.pulse //3 times of sleep interval
+ t.CollectDeadNodeAndFullVolumes(freshThreshHold, t.volumeSizeLimit)
+ }
time.Sleep(time.Duration(float32(t.pulse*1e3)*(1+rand.Float32())) * time.Millisecond)
}
}()
go func(garbageThreshold string) {
c := time.Tick(15 * time.Minute)
- for _ = range c {
- t.Vacuum(garbageThreshold)
+ if t.IsLeader {
+ for _ = range c {
+ t.Vacuum(garbageThreshold)
+ }
}
}(garbageThreshold)
go func() {