WithWorkers configures the PHP workers to start
(name, fileName string, num int, options ...WorkerOption)
| 88 | |
| 89 | // WithWorkers configures the PHP workers to start |
| 90 | func WithWorkers(name, fileName string, num int, options ...WorkerOption) Option { |
| 91 | return func(o *opt) error { |
| 92 | worker := workerOpt{ |
| 93 | name: name, |
| 94 | fileName: fileName, |
| 95 | num: num, |
| 96 | env: PrepareEnv(nil), |
| 97 | watch: []string{}, |
| 98 | maxConsecutiveFailures: defaultMaxConsecutiveFailures, |
| 99 | } |
| 100 | |
| 101 | for _, option := range options { |
| 102 | if err := option(&worker); err != nil { |
| 103 | return err |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | o.workers = append(o.workers, worker) |
| 108 | |
| 109 | return nil |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | // EXPERIMENTAL: WithExtensionWorkers allow extensions to create workers. |
| 114 | // |