avoid ticker leak

This commit is contained in:
chrislu 2024-05-24 17:15:12 -07:00
parent ba98f02d02
commit 364bb6c7b4
4 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,7 @@ func main() {
go func() {
ticker := time.NewTicker(1000 * time.Millisecond)
defer ticker.Stop()
var lastTime time.Time
var counter, size int64

View File

@ -72,6 +72,7 @@ func main() {
go func() {
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
var lastTime time.Time
var counter, size int64

View File

@ -297,6 +297,7 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
}()
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for {
select {
case message := <-messageChan:

View File

@ -159,7 +159,9 @@ func (vs *VolumeServer) doHeartbeat(masterAddress pb.ServerAddress, grpcDialOpti
}
volumeTickChan := time.NewTicker(sleepInterval)
defer volumeTickChan.Stop()
ecShardTickChan := time.NewTicker(17 * sleepInterval)
defer ecShardTickChan.Stop()
dataCenter := vs.store.GetDataCenter()
rack := vs.store.GetRack()
ip := vs.store.Ip