← 返回卡片

原书出处

Cloud Native Go (Matthew A. Titmus)

07 Scalability

Early Release,第8次发布(版权页2021-01-26);实际正文第1—9章 · 核验版本的摘录快照 · 导入于 2026-10-25T19:33:22.053Z

The solution: always be sure to stop your timers. A defer works quite nicely for this purpose: func timelyFixed() { timer := time.NewTimer(5 * time.Second) ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() // Be sure to stop the ticker! done := make(chan bool) go func() { for { select { case <-ticker.C: fmt.Println("Tick!") case <-done:

此预览只包含定位所需的摘录和上下文。

原书定位详情

来源:a19c7933-4eda-4176-aebd-30fe7e1ad292

正文位置:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch07.xhtml

EPUB SHA-256:1154caa7b61465daf957a7d8f1350ef24ab5db9c850cab5987aae5bc74986022