Timers and Tickers
Many long-lived applications impose limits on how long an operation can last. They also perform tasks such as health checks periodically to ensure all components are working as expected. Many platforms provide high-precision timer operations, and the Go standard library provides portable abstractions of these services in the time
package. We will look at timers and tickers in this chapter. Timers are tools for doing things later, and tickers are tools for doing things periodically.
The key sections we will review in this chapter are the following:
- Timer – running something later
- Tickers – running something periodically
At the end of this chapter, you will have seen how to work with timers and tickers and how you can monitor other goroutines using heartbeats.