summaryrefslogtreecommitdiff
path: root/plugins/jobs/config.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-09-16 21:46:50 +0300
committerGitHub <[email protected]>2021-09-16 21:46:50 +0300
commit3581b45f237a3f7aa29591ceb2bf6f4a4642a2f5 (patch)
treee723b19ec1ac16b7ccc7b3c2da69d4a416d63d81 /plugins/jobs/config.go
parent337d292dd2d6ff0a555098b1970d8194d8df8bc2 (diff)
parent823d831b57b75f70c7c3bbbee355f2016633bb3b (diff)
[#803]: feat(plugins): move plugins to a separate repositoryv2.5.0-alpha.2
[#803]: feat(plugins): move plugins to a separate repository
Diffstat (limited to 'plugins/jobs/config.go')
-rw-r--r--plugins/jobs/config.go62
1 files changed, 0 insertions, 62 deletions
diff --git a/plugins/jobs/config.go b/plugins/jobs/config.go
deleted file mode 100644
index 454256b9..00000000
--- a/plugins/jobs/config.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package jobs
-
-import (
- "runtime"
-
- poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- "github.com/spiral/roadrunner/v2/plugins/jobs/pipeline"
-)
-
-const (
- // name used to set pipeline name
- pipelineName string = "name"
-)
-
-// Config defines settings for job broker, workers and job-pipeline mapping.
-type Config struct {
- // NumPollers configures number of priority queue pollers
- // Should be no more than 255
- // Default - num logical cores
- NumPollers uint8 `mapstructure:"num_pollers"`
-
- // PipelineSize is the limit of a main jobs queue which consume Items from the drivers pipeline
- // Driver pipeline might be much larger than a main jobs queue
- PipelineSize uint64 `mapstructure:"pipeline_size"`
-
- // Timeout in seconds is the per-push limit to put the job into queue
- Timeout int `mapstructure:"timeout"`
-
- // Pool configures roadrunner workers pool.
- Pool *poolImpl.Config `mapstructure:"Pool"`
-
- // Pipelines defines mapping between PHP job pipeline and associated job broker.
- Pipelines map[string]*pipeline.Pipeline `mapstructure:"pipelines"`
-
- // Consuming specifies names of pipelines to be consumed on service start.
- Consume []string `mapstructure:"consume"`
-}
-
-func (c *Config) InitDefaults() {
- if c.Pool == nil {
- c.Pool = &poolImpl.Config{}
- }
-
- if c.PipelineSize == 0 {
- c.PipelineSize = 1_000_000
- }
-
- if c.NumPollers == 0 {
- c.NumPollers = uint8(runtime.NumCPU())
- }
-
- for k := range c.Pipelines {
- // set the pipeline name
- c.Pipelines[k].With(pipelineName, k)
- }
-
- if c.Timeout == 0 {
- c.Timeout = 60
- }
-
- c.Pool.InitDefaults()
-}