diff options
author | Valery Piashchynski <[email protected]> | 2021-07-01 21:28:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-01 21:28:23 +0300 |
commit | a4b9d0c47494431c30f357c3616e53baf411360f (patch) | |
tree | 281f19cb031ff66f6360e11ec610dbc0a2fd7920 /plugins/jobs/config.go | |
parent | cd64c6c44ad463963705a22af2bd49059987949c (diff) |
- Remove Dispatcher
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/config.go')
-rw-r--r-- | plugins/jobs/config.go | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/plugins/jobs/config.go b/plugins/jobs/config.go index bb042ec9..87e36ecb 100644 --- a/plugins/jobs/config.go +++ b/plugins/jobs/config.go @@ -1,11 +1,8 @@ package jobs import ( - "github.com/spiral/errors" poolImpl "github.com/spiral/roadrunner/v2/pkg/pool" - "github.com/spiral/roadrunner/v2/plugins/jobs/dispatcher" "github.com/spiral/roadrunner/v2/plugins/jobs/pipeline" - "github.com/spiral/roadrunner/v2/plugins/jobs/structs" ) // Config defines settings for job broker, workers and job-pipeline mapping. @@ -14,58 +11,17 @@ type Config struct { // Workers *roadrunner.ServerConfig poolCfg *poolImpl.Config - // Dispatch defines where and how to match jobs. - Dispatch map[string]*structs.Options - // Pipelines defines mapping between PHP job pipeline and associated job broker. Pipelines map[string]*pipeline.Pipeline // Consuming specifies names of pipelines to be consumed on service start. Consume []string - - // parent config for broken options. - pipelines pipeline.Pipelines - route dispatcher.Dispatcher } -func (c *Config) InitDefaults() error { - const op = errors.Op("config_init_defaults") - var err error - c.pipelines, err = pipeline.InitPipelines(c.Pipelines) - if err != nil { - return errors.E(op, err) - } - +func (c *Config) InitDefaults() { if c.poolCfg == nil { c.poolCfg = &poolImpl.Config{} } c.poolCfg.InitDefaults() - - return nil -} - -// MatchPipeline locates the pipeline associated with the job. -func (c *Config) MatchPipeline(job *structs.Job) (*pipeline.Pipeline, *structs.Options, error) { - const op = errors.Op("config_match_pipeline") - opt := c.route.Match(job) - - pipe := "" - if job.Options != nil { - pipe = job.Options.Pipeline - } - - if pipe == "" && opt != nil { - pipe = opt.Pipeline - } - - if pipe == "" { - return nil, nil, errors.E(op, errors.Errorf("unable to locate pipeline for `%s`", job.Job)) - } - - if p := c.pipelines.Get(pipe); p != nil { - return p, opt, nil - } - - return nil, nil, errors.E(op, errors.Errorf("undefined pipeline `%s`", pipe)) } |