summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-07 18:40:11 +0300
committerValery Piashchynski <[email protected]>2021-02-07 18:40:11 +0300
commitae8af5413143636d5fe52ddaffa5d9122681bc20 (patch)
tree06691b0ce0515cab5f5c9f9e79caf0a7338c6bf0 /plugins
parent7b63af9b205be85ed2a50408f762344e1aba1a46 (diff)
Update config
Endure updated to beta.23 Tests update
Diffstat (limited to 'plugins')
-rw-r--r--plugins/http/plugin.go28
-rw-r--r--plugins/server/plugin.go2
2 files changed, 16 insertions, 14 deletions
diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go
index 3672f5ac..ff0c1c30 100644
--- a/plugins/http/plugin.go
+++ b/plugins/http/plugin.go
@@ -102,19 +102,6 @@ func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, server server.Se
}
s.cfg.Env[RR_MODE] = "http"
-
- s.pool, err = server.NewWorkerPool(context.Background(), pool.Config{
- Debug: s.cfg.Pool.Debug,
- NumWorkers: s.cfg.Pool.NumWorkers,
- MaxJobs: s.cfg.Pool.MaxJobs,
- AllocateTimeout: s.cfg.Pool.AllocateTimeout,
- DestroyTimeout: s.cfg.Pool.DestroyTimeout,
- Supervisor: s.cfg.Pool.Supervisor,
- }, s.cfg.Env, s.logCallback)
- if err != nil {
- return errors.E(op, err)
- }
-
s.server = server
return nil
@@ -141,6 +128,19 @@ func (s *Plugin) Serve() chan error {
errCh := make(chan error, 2)
var err error
+ s.pool, err = s.server.NewWorkerPool(context.Background(), pool.Config{
+ Debug: s.cfg.Pool.Debug,
+ NumWorkers: s.cfg.Pool.NumWorkers,
+ MaxJobs: s.cfg.Pool.MaxJobs,
+ AllocateTimeout: s.cfg.Pool.AllocateTimeout,
+ DestroyTimeout: s.cfg.Pool.DestroyTimeout,
+ Supervisor: s.cfg.Pool.Supervisor,
+ }, s.cfg.Env, s.logCallback)
+ if err != nil {
+ errCh <- errors.E(op, err)
+ return errCh
+ }
+
s.handler, err = NewHandler(
s.cfg.MaxRequestSize,
*s.cfg.Uploads,
@@ -303,6 +303,8 @@ func (s *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Workers returns associated pool workers
func (s *Plugin) Workers() []worker.BaseProcess {
+ s.Lock()
+ defer s.Unlock()
workers := s.pool.Workers()
baseWorkers := make([]worker.BaseProcess, 0, len(workers))
for i := 0; i < len(workers); i++ {
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 99d93d19..3fc77926 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -51,7 +51,7 @@ func (server *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
server.factory, err = server.initFactory()
if err != nil {
- return errors.E(err)
+ return errors.E(op, err)
}
return nil