func()

in cmd/checker/gcp.go [156:172]


func (tc *tokenCache) loop() {
	delaySecs := tc.current.ExpiresIn - 1
	for {
		time.Sleep(time.Duration(delaySecs) * time.Second)
		tok, err := tc.fetchToken()
		if err != nil {
			log.Printf("fetching token failed:  %s", err)
			delaySecs = 2
		} else {
			delaySecs = tok.ExpiresIn - 1
		}

		tc.mu.Lock()
		tc.current = tok
		tc.mu.Unlock()
	}
}