refactor: simplify startSystemUpdateTicker using time.Tick (#347)

According to the Go 1.23 documentation, the garbage collector can now recover unreferenced tickers created with time.Tick, making time.NewTicker method unnecessary in most cases.

Reference:

* time.Tick: https://pkg.go.dev/time#Tick
This commit is contained in:
Chuangbo Li
2024-12-29 06:07:32 +08:00
committed by GitHub
parent 19b4477a75
commit 0c9bc47a3a

View File

@@ -227,8 +227,8 @@ func (h *Hub) Run() {
} }
func (h *Hub) startSystemUpdateTicker() { func (h *Hub) startSystemUpdateTicker() {
ticker := time.NewTicker(15 * time.Second) c := time.Tick(15 * time.Second)
for range ticker.C { for range c {
h.updateSystems() h.updateSystems()
} }
} }