/
githubmirror
/
terraform
Обзор
Документация
Войти
/
githubmirror
/
terraform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
internal/backend/remote/cloud_integration.go
36 строк
938 B
Radek Simko
make copyrightfix
17 фев 2026, 16:56
17 фев 2026, 16:56
0fe906f
Код
Авторство
О чём код?
// Copyright IBM Corp. 2014, 2026 // SPDX-License-Identifier: BUSL-1.1 package remote import ( "context" "log" "time" ) // IntegrationContext is a set of data that is useful when performing HCP Terraform integration operations type IntegrationContext struct { StopContext context.Context CancelContext context.Context } func (s *IntegrationContext) Poll(backoffMinInterval float64, backoffMaxInterval float64, every func(i int) (bool, error)) error { for i := 0; ; i++ { select { case <-s.StopContext.Done(): log.Print("IntegrationContext.Poll: StopContext.Done() called") return s.StopContext.Err() case <-s.CancelContext.Done(): log.Print("IntegrationContext.Poll: CancelContext.Done() called") return s.CancelContext.Err() case <-time.After(backoff(backoffMinInterval, backoffMaxInterval, i)): // blocks for a time between min and max } cont, err := every(i) if !cont { return err } } }