mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
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:
@@ -227,8 +227,8 @@ func (h *Hub) Run() {
|
||||
}
|
||||
|
||||
func (h *Hub) startSystemUpdateTicker() {
|
||||
ticker := time.NewTicker(15 * time.Second)
|
||||
for range ticker.C {
|
||||
c := time.Tick(15 * time.Second)
|
||||
for range c {
|
||||
h.updateSystems()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user