summaryrefslogtreecommitdiff
path: root/plugins/factory
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/factory')
-rwxr-xr-xplugins/factory/app.go9
-rwxr-xr-xplugins/factory/tests/plugin_1.go2
-rwxr-xr-xplugins/factory/tests/plugin_2.go20
3 files changed, 16 insertions, 15 deletions
diff --git a/plugins/factory/app.go b/plugins/factory/app.go
index 62da4f53..4951e3df 100755
--- a/plugins/factory/app.go
+++ b/plugins/factory/app.go
@@ -3,15 +3,16 @@ package factory
import (
"context"
"fmt"
+ "log"
+ "os"
+ "os/exec"
+ "strings"
+
"github.com/fatih/color"
"github.com/spiral/endure/errors"
"github.com/spiral/roadrunner/v2"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/util"
- "log"
- "os"
- "os/exec"
- "strings"
)
const ServiceName = "app"
diff --git a/plugins/factory/tests/plugin_1.go b/plugins/factory/tests/plugin_1.go
index df632481..9011bb00 100755
--- a/plugins/factory/tests/plugin_1.go
+++ b/plugins/factory/tests/plugin_1.go
@@ -29,7 +29,7 @@ func (f *Foo) Serve() chan error {
return errCh
}
- cmd, err := f.spawner.CommandFactory(nil)
+ cmd, err := f.spawner.NewCmdFactory(nil)
if err != nil {
errCh <- err
return errCh
diff --git a/plugins/factory/tests/plugin_2.go b/plugins/factory/tests/plugin_2.go
index dbdb065b..9f401bec 100755
--- a/plugins/factory/tests/plugin_2.go
+++ b/plugins/factory/tests/plugin_2.go
@@ -14,13 +14,11 @@ import (
type Foo2 struct {
configProvider config.Provider
wf factory.AppFactory
- spw factory.Spawner
}
-func (f *Foo2) Init(p config.Provider, workerFactory factory.AppFactory, spawner factory.Spawner) error {
+func (f *Foo2) Init(p config.Provider, workerFactory factory.AppFactory) error {
f.configProvider = p
f.wf = workerFactory
- f.spw = spawner
return nil
}
@@ -34,7 +32,7 @@ func (f *Foo2) Serve() chan error {
return errCh
}
- cmd, err := f.spw.CommandFactory(nil)
+ cmd, err := f.wf.NewCmdFactory(nil)
if err != nil {
errCh <- err
return errCh
@@ -58,16 +56,18 @@ func (f *Foo2) Serve() chan error {
_ = w
- poolConfig := &roadrunner.Config{
+ poolConfig := roadrunner.Config{
NumWorkers: 10,
MaxJobs: 100,
AllocateTimeout: time.Second * 10,
DestroyTimeout: time.Second * 10,
- TTL: 1000,
- IdleTTL: 1000,
- ExecTTL: time.Second * 10,
- MaxPoolMemory: 10000,
- MaxWorkerMemory: 10000,
+ Supervisor: roadrunner.SupervisorConfig{
+ WatchTick: 60,
+ TTL: 1000,
+ IdleTTL: 10,
+ ExecTTL: time.Second * 10,
+ MaxWorkerMemory: 1000,
+ },
}
pool, err := f.wf.NewWorkerPool(context.Background(), poolConfig, nil)