forked from spotahome/kooper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
36 lines (30 loc) · 942 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package controller
import "time"
// Defaults.
const (
defResyncInterval = 30 * time.Second
defConcurrentWorkers = 1
defProcessingJobRetries = 3
)
// Config is the controller configuration.
type Config struct {
// name of the controller.
Name string
// ConcurrentWorkers is the number of concurrent workers the controller will have running processing events.
ConcurrentWorkers int
// ResyncInterval is the interval the controller will process all the selected resources.
ResyncInterval time.Duration
// ProcessingJobRetries is the number of times the job will try to reprocess the event before returning a real error.
ProcessingJobRetries int
}
func (c *Config) setDefaults() {
if c.ConcurrentWorkers <= 0 {
c.ConcurrentWorkers = defConcurrentWorkers
}
if c.ResyncInterval <= 0 {
c.ResyncInterval = defResyncInterval
}
if c.ProcessingJobRetries <= 0 {
c.ProcessingJobRetries = defProcessingJobRetries
}
}