Skip to content

Commit 646c05f

Browse files
feat: configurable polling interval (#35)
1 parent 612b35a commit 646c05f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

shared/configuration.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ const (
3737
IonosS3SecretKeyEnvVar = "IONOS_S3_SECRET_KEY"
3838
DefaultIonosServerUrl = "https://api.ionos.com/"
3939

40-
defaultMaxRetries = 3
41-
defaultWaitTime = time.Duration(100) * time.Millisecond
42-
defaultMaxWaitTime = time.Duration(2000) * time.Millisecond
40+
defaultMaxRetries = 3
41+
defaultWaitTime = time.Duration(100) * time.Millisecond
42+
defaultMaxWaitTime = time.Duration(2000) * time.Millisecond
43+
defaultPollInterval = 1 * time.Second
4344
)
4445

4546
// contextKeys are used to identify the type of value in the context.
@@ -135,6 +136,7 @@ type Configuration struct {
135136
MaxRetries int `json:"maxRetries,omitempty"`
136137
WaitTime time.Duration `json:"waitTime,omitempty"`
137138
MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"`
139+
PollInterval time.Duration `json:"pollInterval,omitempty"`
138140

139141
Middleware MiddlewareFunction `json:"-"`
140142
MiddlewareWithError MiddlewareFunctionWithError `json:"-"`
@@ -152,6 +154,7 @@ func NewConfiguration(username, password, token, hostUrl string) *Configuration
152154
Token: token,
153155
MaxRetries: defaultMaxRetries,
154156
MaxWaitTime: defaultMaxWaitTime,
157+
PollInterval: defaultPollInterval,
155158
WaitTime: defaultWaitTime,
156159
Servers: ServerConfigurations{},
157160
OperationServers: map[string]ServerConfigurations{},

0 commit comments

Comments
 (0)