MCPcopy Index your code
hub / github.com/sourcegraph/checkup / CheckAndStoreEvery

Method CheckAndStoreEvery

checkup.go:128–138  ·  view source on GitHub ↗

CheckAndStoreEvery calls CheckAndStore every interval. It returns the ticker that it's using so you can stop it when you don't want it to run anymore. This function does NOT block (it runs the ticker in a goroutine). Any errors are written to the standard logger. It would not be wise to set an inter

(interval time.Duration)

Source from the content-addressed store, hash-verified

126// would not be wise to set an interval lower than the time it takes
127// to perform the checks.
128func (c Checkup) CheckAndStoreEvery(interval time.Duration) *time.Ticker {
129 ticker := time.NewTicker(interval)
130 go func() {
131 for range ticker.C {
132 if err := c.CheckAndStore(); err != nil {
133 log.Println(err)
134 }
135 }
136 }()
137 return ticker
138}
139
140// MarshalJSON marshals c into JSON with type information
141// included on the interface values.

Callers 2

TestCheckAndStoreEveryFunction · 0.95
every.goFile · 0.80

Calls 1

CheckAndStoreMethod · 0.95

Tested by 1

TestCheckAndStoreEveryFunction · 0.76