summaryrefslogtreecommitdiff
path: root/pkg/pool/config.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-15 00:29:23 +0300
committerValery Piashchynski <[email protected]>2021-01-15 00:29:23 +0300
commitaff4d2c7a92ae014988b27b27069b15a971b6c36 (patch)
tree50dc6e22db7ff51b0fcf3cce0a45b7b739e1f300 /pkg/pool/config.go
parent7542ae2d4c392290766405d31996378378aad975 (diff)
Viper doesn't support `yaml` structure tags, it uses mapstructure
instead
Diffstat (limited to 'pkg/pool/config.go')
-rw-r--r--pkg/pool/config.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg/pool/config.go b/pkg/pool/config.go
index acdd3d6f..e3e2d3cd 100644
--- a/pkg/pool/config.go
+++ b/pkg/pool/config.go
@@ -12,23 +12,23 @@ type Config struct {
// NumWorkers defines how many sub-processes can be run at once. This value
// might be doubled by Swapper while hot-swap. Defaults to number of CPU cores.
- NumWorkers int64 `yaml:"num_workers"`
+ NumWorkers int64 `mapstructure:"num_workers"`
// MaxJobs defines how many executions is allowed for the worker until
// it's destruction. set 1 to create new process for each new task, 0 to let
// worker handle as many tasks as it can.
- MaxJobs int64 `yaml:"max_jobs"`
+ MaxJobs int64 `mapstructure:"max_jobs"`
// AllocateTimeout defines for how long pool will be waiting for a worker to
// be freed to handle the task. Defaults to 60s.
- AllocateTimeout time.Duration `yaml:"allocate_timeout"`
+ AllocateTimeout time.Duration `mapstructure:"allocate_timeout"`
// DestroyTimeout defines for how long pool should be waiting for worker to
// properly destroy, if timeout reached worker will be killed. Defaults to 60s.
- DestroyTimeout time.Duration `yaml:"destroy_timeout"`
+ DestroyTimeout time.Duration `mapstructure:"destroy_timeout"`
// Supervision config to limit worker and pool memory usage.
- Supervisor *SupervisorConfig `yaml:"supervisor"`
+ Supervisor *SupervisorConfig `mapstructure:"supervisor"`
}
// InitDefaults enables default config values.
@@ -52,19 +52,19 @@ func (cfg *Config) InitDefaults() {
type SupervisorConfig struct {
// WatchTick defines how often to check the state of worker.
- WatchTick uint64 `yaml:"watch_tick"`
+ WatchTick uint64 `mapstructure:"watch_tick"`
// TTL defines maximum time worker is allowed to live.
- TTL uint64 `yaml:"ttl"`
+ TTL uint64 `mapstructure:"ttl"`
// IdleTTL defines maximum duration worker can spend in idle mode. Disabled when 0.
- IdleTTL uint64 `yaml:"idle_ttl"`
+ IdleTTL uint64 `mapstructure:"idle_ttl"`
// ExecTTL defines maximum lifetime per job.
- ExecTTL uint64 `yaml:"exec_ttl"`
+ ExecTTL uint64 `mapstructure:"exec_ttl"`
// MaxWorkerMemory limits memory per worker.
- MaxWorkerMemory uint64 `yaml:"max_worker_memory"`
+ MaxWorkerMemory uint64 `mapstructure:"max_worker_memory"`
}
// InitDefaults enables default config values.