Skip to content

Instantly share code, notes, and snippets.

@cezarsa
Last active March 10, 2022 18:20
Show Gist options
  • Save cezarsa/df86d501d072f7bb184daf0b541655e3 to your computer and use it in GitHub Desktop.
Save cezarsa/df86d501d072f7bb184daf0b541655e3 to your computer and use it in GitHub Desktop.
ticker := time.NewTicker(time.Minute)
defer ticker.Stop()
for {
select {
case <-ticker.C:
// poll the image build status
case evt := <-webhookRequest:
ticker.Reset(time.Minute)
// update the image build status with evt
case <-time.After(30*time.Minute):
// fail on overall timeout
}
// break if image build status != pending
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment