diff options
author | Valery Piashchynski <[email protected]> | 2020-11-16 15:11:27 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-16 15:11:27 +0300 |
commit | d40ff179e43a02726bfa4298e523a16c79a88cea (patch) | |
tree | 2677952acd0a396f1950b2e85cae62e8b9818d7a | |
parent | a7ba4df83b4f2c67a3a0fb9d1dd35663935c90be (diff) |
Rename app->server
Rename Config -> PoolConfig
-rwxr-xr-x | .github/workflows/ci-build.yml | 4 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | interfaces/server/interface.go | 17 | ||||
-rw-r--r-- | plugins/server/config.go (renamed from plugins/app/config.go) | 10 | ||||
-rw-r--r-- | plugins/server/plugin.go (renamed from plugins/app/plugin.go) | 22 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr-no-app-section.yaml (renamed from plugins/app/tests/configs/.rr-no-app-section.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr-sockets.yaml (renamed from plugins/app/tests/configs/.rr-sockets.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr-tcp.yaml (renamed from plugins/app/tests/configs/.rr-tcp.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr-wrong-command.yaml (renamed from plugins/app/tests/configs/.rr-wrong-command.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr-wrong-relay.yaml (renamed from plugins/app/tests/configs/.rr-wrong-relay.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/configs/.rr.yaml (renamed from plugins/app/tests/configs/.rr.yaml) | 2 | ||||
-rw-r--r-- | plugins/server/tests/plugin_pipes.go (renamed from plugins/app/tests/plugin_pipes.go) | 11 | ||||
-rw-r--r-- | plugins/server/tests/plugin_sockets.go (renamed from plugins/app/tests/plugin_sockets.go) | 9 | ||||
-rw-r--r-- | plugins/server/tests/plugin_tcp.go (renamed from plugins/app/tests/plugin_tcp.go) | 9 | ||||
-rw-r--r-- | plugins/server/tests/server_test.go (renamed from plugins/app/tests/app_test.go) | 16 | ||||
-rw-r--r-- | plugins/server/tests/socket.php (renamed from plugins/app/tests/socket.php) | 0 | ||||
-rw-r--r-- | plugins/server/tests/tcp.php (renamed from plugins/app/tests/tcp.php) | 0 | ||||
-rwxr-xr-x | pool.go | 6 | ||||
-rwxr-xr-x | static_pool.go | 8 | ||||
-rwxr-xr-x | static_pool_test.go | 24 | ||||
-rwxr-xr-x | supervisor_pool.go | 2 | ||||
-rw-r--r-- | supervisor_test.go | 6 |
22 files changed, 87 insertions, 71 deletions
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6ce80f9c..06e260ce 100755 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -70,14 +70,14 @@ jobs: go test -v -race ./plugins/rpc/tests -tags=debug -coverprofile=rpc.txt -covermode=atomic go test -v -race ./plugins/config/tests -tags=debug -coverprofile=plugin_config.txt -covermode=atomic go test -v -race ./plugins/logger/tests -tags=debug -coverprofile=logger.txt -covermode=atomic - go test -v -race ./plugins/app/tests -tags=debug -coverprofile=app.txt -covermode=atomic + go test -v -race ./plugins/server/tests -tags=debug -coverprofile=server.txt -covermode=atomic go test -v -race ./plugins/metrics/tests -tags=debug -coverprofile=metrics.txt -covermode=atomic - name: Run code coverage uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: lib.txt, rpc_config.txt, rpc.txt, plugin_config.txt, logger.txt, app.txt, metrics.txt + files: lib.txt, rpc_config.txt, rpc.txt, plugin_config.txt, logger.txt, server.txt, metrics.txt flags: unittests name: codecov-umbrella fail_ci_if_error: false @@ -3,6 +3,6 @@ test: go test -v -race -cover ./plugins/rpc -tags=debug go test -v -race -cover ./plugins/rpc/tests -tags=debug go test -v -race -cover ./plugins/config/tests -tags=debug - go test -v -race -cover ./plugins/app/tests -tags=debug + go test -v -race -cover ./plugins/server/tests -tags=debug go test -v -race -cover ./plugins/logger/tests -tags=debug go test -v -race -cover ./plugins/metrics/tests -tags=debug
\ No newline at end of file diff --git a/interfaces/server/interface.go b/interfaces/server/interface.go new file mode 100644 index 00000000..51d172cb --- /dev/null +++ b/interfaces/server/interface.go @@ -0,0 +1,17 @@ +package server + +import ( + "context" + "os/exec" + + "github.com/spiral/roadrunner/v2" +) + +type Env map[string]string + +// WorkerFactory creates workers for the application. +type WorkerFactory interface { + CmdFactory(env Env) (func() *exec.Cmd, error) + NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBase, error) + NewWorkerPool(ctx context.Context, opt roadrunner.PoolConfig, env Env) (roadrunner.Pool, error) +} diff --git a/plugins/app/config.go b/plugins/server/config.go index eaa54e2d..147ae0f7 100644 --- a/plugins/app/config.go +++ b/plugins/server/config.go @@ -1,6 +1,10 @@ -package app +package server -import "time" +import ( + "time" + + "github.com/spiral/roadrunner/v2/interfaces/server" +) // Config config combines factory, pool and cmd configurations. type Config struct { @@ -14,7 +18,7 @@ type Config struct { Group string // Env represents application environment. - Env Env + Env server.Env // Listen defines connection method and factory to be used to connect to workers: // "pipes", "tcp://:6001", "unix://rr.sock" diff --git a/plugins/app/plugin.go b/plugins/server/plugin.go index ed2880cc..e096708a 100644 --- a/plugins/app/plugin.go +++ b/plugins/server/plugin.go @@ -1,4 +1,4 @@ -package app +package server import ( "context" @@ -10,20 +10,12 @@ import ( "github.com/spiral/errors" "github.com/spiral/roadrunner/v2" "github.com/spiral/roadrunner/v2/interfaces/log" + "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/util" ) -const ServiceName = "app" - -type Env map[string]string - -// WorkerFactory creates workers for the application. -type WorkerFactory interface { - CmdFactory(env Env) (func() *exec.Cmd, error) - NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBase, error) - NewWorkerPool(ctx context.Context, opt roadrunner.Config, env Env) (roadrunner.Pool, error) -} +const ServiceName = "server" // Plugin manages worker type Plugin struct { @@ -71,7 +63,7 @@ func (app *Plugin) Stop() error { } // CmdFactory provides worker command factory assocated with given context. -func (app *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error) { +func (app *Plugin) CmdFactory(env server.Env) (func() *exec.Cmd, error) { var cmdArgs []string // create command according to the config @@ -97,7 +89,7 @@ func (app *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error) { } // NewWorker issues new standalone worker. -func (app *Plugin) NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBase, error) { +func (app *Plugin) NewWorker(ctx context.Context, env server.Env) (roadrunner.WorkerBase, error) { const op = errors.Op("new worker") spawnCmd, err := app.CmdFactory(env) if err != nil { @@ -115,7 +107,7 @@ func (app *Plugin) NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBas } // NewWorkerPool issues new worker pool. -func (app *Plugin) NewWorkerPool(ctx context.Context, opt roadrunner.Config, env Env) (roadrunner.Pool, error) { +func (app *Plugin) NewWorkerPool(ctx context.Context, opt roadrunner.PoolConfig, env server.Env) (roadrunner.Pool, error) { spawnCmd, err := app.CmdFactory(env) if err != nil { return nil, err @@ -159,7 +151,7 @@ func (app *Plugin) initFactory() (roadrunner.Factory, error) { } } -func (app *Plugin) setEnv(e Env) []string { +func (app *Plugin) setEnv(e server.Env) []string { env := append(os.Environ(), fmt.Sprintf("RR_RELAY=%s", app.cfg.Relay)) for k, v := range e { env = append(env, fmt.Sprintf("%s=%s", strings.ToUpper(k), v)) diff --git a/plugins/app/tests/configs/.rr-no-app-section.yaml b/plugins/server/tests/configs/.rr-no-app-section.yaml index d129ae8a..b6e3ea93 100644 --- a/plugins/app/tests/configs/.rr-no-app-section.yaml +++ b/plugins/server/tests/configs/.rr-no-app-section.yaml @@ -1,4 +1,4 @@ -upp: +server: command: "php ../../../tests/client.php echo pipes" user: "" group: "" diff --git a/plugins/app/tests/configs/.rr-sockets.yaml b/plugins/server/tests/configs/.rr-sockets.yaml index 9bd62693..ab1239aa 100644 --- a/plugins/app/tests/configs/.rr-sockets.yaml +++ b/plugins/server/tests/configs/.rr-sockets.yaml @@ -1,4 +1,4 @@ -app: +server: command: "php socket.php" user: "" group: "" diff --git a/plugins/app/tests/configs/.rr-tcp.yaml b/plugins/server/tests/configs/.rr-tcp.yaml index c5a26d37..f53bffcc 100644 --- a/plugins/app/tests/configs/.rr-tcp.yaml +++ b/plugins/server/tests/configs/.rr-tcp.yaml @@ -1,4 +1,4 @@ -app: +server: command: "php tcp.php" user: "" group: "" diff --git a/plugins/app/tests/configs/.rr-wrong-command.yaml b/plugins/server/tests/configs/.rr-wrong-command.yaml index 4bd019d3..d2c087a6 100644 --- a/plugins/app/tests/configs/.rr-wrong-command.yaml +++ b/plugins/server/tests/configs/.rr-wrong-command.yaml @@ -1,4 +1,4 @@ -app: +server: command: "php some_absent_file.php" user: "" group: "" diff --git a/plugins/app/tests/configs/.rr-wrong-relay.yaml b/plugins/server/tests/configs/.rr-wrong-relay.yaml index d8ffe8f8..1dd73d73 100644 --- a/plugins/app/tests/configs/.rr-wrong-relay.yaml +++ b/plugins/server/tests/configs/.rr-wrong-relay.yaml @@ -1,4 +1,4 @@ -app: +server: command: "php ../../../tests/client.php echo pipes" user: "" group: "" diff --git a/plugins/app/tests/configs/.rr.yaml b/plugins/server/tests/configs/.rr.yaml index 221aff92..b6e3ea93 100644 --- a/plugins/app/tests/configs/.rr.yaml +++ b/plugins/server/tests/configs/.rr.yaml @@ -1,4 +1,4 @@ -app: +server: command: "php ../../../tests/client.php echo pipes" user: "" group: "" diff --git a/plugins/app/tests/plugin_pipes.go b/plugins/server/tests/plugin_pipes.go index fc999718..840021eb 100644 --- a/plugins/app/tests/plugin_pipes.go +++ b/plugins/server/tests/plugin_pipes.go @@ -6,14 +6,15 @@ import ( "github.com/spiral/errors" "github.com/spiral/roadrunner/v2" - "github.com/spiral/roadrunner/v2/plugins/app" + "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/plugins/config" + plugin "github.com/spiral/roadrunner/v2/plugins/server" ) const ConfigSection = "app" const Response = "test" -var testPoolConfig = roadrunner.Config{ +var testPoolConfig = roadrunner.PoolConfig{ NumWorkers: 10, MaxJobs: 100, AllocateTimeout: time.Second * 10, @@ -29,11 +30,11 @@ var testPoolConfig = roadrunner.Config{ type Foo struct { configProvider config.Configurer - wf app.WorkerFactory + wf server.WorkerFactory pool roadrunner.Pool } -func (f *Foo) Init(p config.Configurer, workerFactory app.WorkerFactory) error { +func (f *Foo) Init(p config.Configurer, workerFactory server.WorkerFactory) error { f.configProvider = p f.wf = workerFactory return nil @@ -50,7 +51,7 @@ func (f *Foo) Serve() chan error { errCh := make(chan error, 1) - conf := &app.Config{} + conf := &plugin.Config{} var err error err = f.configProvider.UnmarshalKey(ConfigSection, conf) if err != nil { diff --git a/plugins/app/tests/plugin_sockets.go b/plugins/server/tests/plugin_sockets.go index 585264f6..b12f4ead 100644 --- a/plugins/app/tests/plugin_sockets.go +++ b/plugins/server/tests/plugin_sockets.go @@ -5,17 +5,18 @@ import ( "github.com/spiral/errors" "github.com/spiral/roadrunner/v2" - "github.com/spiral/roadrunner/v2/plugins/app" + "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/plugins/config" + plugin "github.com/spiral/roadrunner/v2/plugins/server" ) type Foo2 struct { configProvider config.Configurer - wf app.WorkerFactory + wf server.WorkerFactory pool roadrunner.Pool } -func (f *Foo2) Init(p config.Configurer, workerFactory app.WorkerFactory) error { +func (f *Foo2) Init(p config.Configurer, workerFactory server.WorkerFactory) error { f.configProvider = p f.wf = workerFactory return nil @@ -25,7 +26,7 @@ func (f *Foo2) Serve() chan error { const op = errors.Op("serve") var err error errCh := make(chan error, 1) - conf := &app.Config{} + conf := &plugin.Config{} // test payload for echo r := roadrunner.Payload{ diff --git a/plugins/app/tests/plugin_tcp.go b/plugins/server/tests/plugin_tcp.go index 6abc533d..39044577 100644 --- a/plugins/app/tests/plugin_tcp.go +++ b/plugins/server/tests/plugin_tcp.go @@ -5,17 +5,18 @@ import ( "github.com/spiral/errors" "github.com/spiral/roadrunner/v2" - "github.com/spiral/roadrunner/v2/plugins/app" + "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/plugins/config" + plugin "github.com/spiral/roadrunner/v2/plugins/server" ) type Foo3 struct { configProvider config.Configurer - wf app.WorkerFactory + wf server.WorkerFactory pool roadrunner.Pool } -func (f *Foo3) Init(p config.Configurer, workerFactory app.WorkerFactory) error { +func (f *Foo3) Init(p config.Configurer, workerFactory server.WorkerFactory) error { f.configProvider = p f.wf = workerFactory return nil @@ -25,7 +26,7 @@ func (f *Foo3) Serve() chan error { const op = errors.Op("serve") var err error errCh := make(chan error, 1) - conf := &app.Config{} + conf := &plugin.Config{} // test payload for echo r := roadrunner.Payload{ diff --git a/plugins/app/tests/app_test.go b/plugins/server/tests/server_test.go index 3c416b59..53daa67f 100644 --- a/plugins/app/tests/app_test.go +++ b/plugins/server/tests/server_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/spiral/endure" - "github.com/spiral/roadrunner/v2/plugins/app" + "github.com/spiral/roadrunner/v2/plugins/server" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/logger" "github.com/stretchr/testify/assert" @@ -27,7 +27,7 @@ func TestAppPipes(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -93,7 +93,7 @@ func TestAppSockets(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -159,7 +159,7 @@ func TestAppTCP(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -225,7 +225,7 @@ func TestAppWrongConfig(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -257,7 +257,7 @@ func TestAppWrongRelay(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -295,7 +295,7 @@ func TestAppWrongCommand(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } @@ -333,7 +333,7 @@ func TestAppNoAppSectionInConfig(t *testing.T) { t.Fatal(err) } - err = container.Register(&app.Plugin{}) + err = container.Register(&server.Plugin{}) if err != nil { t.Fatal(err) } diff --git a/plugins/app/tests/socket.php b/plugins/server/tests/socket.php index 143c3ce4..143c3ce4 100644 --- a/plugins/app/tests/socket.php +++ b/plugins/server/tests/socket.php diff --git a/plugins/app/tests/tcp.php b/plugins/server/tests/tcp.php index 2d6fb00a..2d6fb00a 100644 --- a/plugins/app/tests/tcp.php +++ b/plugins/server/tests/tcp.php @@ -49,7 +49,7 @@ type Pool interface { AddListener(listener util.EventListener) // GetConfig returns pool configuration. - GetConfig() Config + GetConfig() PoolConfig // Exec Exec(rqs Payload) (Payload, error) @@ -67,7 +67,7 @@ type Pool interface { } // Configures the pool behaviour. -type Config struct { +type PoolConfig struct { // Debug flag creates new fresh worker before every request. Debug bool @@ -93,7 +93,7 @@ type Config struct { } // InitDefaults enables default config values. -func (cfg *Config) InitDefaults() { +func (cfg *PoolConfig) InitDefaults() { if cfg.NumWorkers == 0 { cfg.NumWorkers = int64(runtime.NumCPU()) } diff --git a/static_pool.go b/static_pool.go index 0e5ee050..c1dacd8d 100755 --- a/static_pool.go +++ b/static_pool.go @@ -29,7 +29,7 @@ type PoolOptions func(p *StaticPool) // StaticPool controls worker creation, destruction and task routing. Pool uses fixed amount of stack. type StaticPool struct { - cfg Config + cfg PoolConfig // worker command creator cmd func() *exec.Cmd @@ -52,7 +52,7 @@ type StaticPool struct { } // NewPool creates new worker pool and task multiplexer. StaticPool will initiate with one worker. -func NewPool(ctx context.Context, cmd func() *exec.Cmd, factory Factory, cfg Config, options ...PoolOptions) (Pool, error) { +func NewPool(ctx context.Context, cmd func() *exec.Cmd, factory Factory, cfg PoolConfig, options ...PoolOptions) (Pool, error) { const op = errors.Op("NewPool") cfg.InitDefaults() @@ -119,8 +119,8 @@ func (sp *StaticPool) AddListener(listener util.EventListener) { sp.events.AddListener(listener) } -// Config returns associated pool configuration. Immutable. -func (sp *StaticPool) GetConfig() Config { +// PoolConfig returns associated pool configuration. Immutable. +func (sp *StaticPool) GetConfig() PoolConfig { return sp.cfg } diff --git a/static_pool_test.go b/static_pool_test.go index d661c34d..27907af5 100755 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/assert" ) -var cfg = Config{ +var cfg = PoolConfig{ NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -52,7 +52,7 @@ func Test_ConfigNoErrorInitDefaults(t *testing.T) { context.Background(), func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ AllocateTimeout: time.Second, DestroyTimeout: time.Second, }, @@ -252,7 +252,7 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { context.Background(), func() *exec.Cmd { return exec.Command("php", "tests/client.php", "delay", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, AllocateTimeout: time.Nanosecond * 1, DestroyTimeout: time.Second * 2, @@ -268,7 +268,7 @@ func Test_StaticPool_Replace_Worker(t *testing.T) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "pid", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, MaxJobs: 1, AllocateTimeout: time.Second, @@ -305,7 +305,7 @@ func Test_StaticPool_Debug_Worker(t *testing.T) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "pid", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ Debug: true, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -345,7 +345,7 @@ func Test_StaticPool_Stop_Worker(t *testing.T) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "stop", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -385,7 +385,7 @@ func Test_Static_Pool_Destroy_And_Close(t *testing.T) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "delay", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -407,7 +407,7 @@ func Test_Static_Pool_Destroy_And_Close_While_Wait(t *testing.T) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "delay", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -437,7 +437,7 @@ func Test_Static_Pool_Handle_Dead(t *testing.T) { context.Background(), func() *exec.Cmd { return exec.Command("php", "tests/slow-destroy.php", "echo", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 5, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -462,7 +462,7 @@ func Test_Static_Pool_Slow_Destroy(t *testing.T) { context.Background(), func() *exec.Cmd { return exec.Command("php", "tests/slow-destroy.php", "echo", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 5, AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -503,7 +503,7 @@ func Benchmark_Pool_Echo_Batched(b *testing.B) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second * 100, DestroyTimeout: time.Second, @@ -533,7 +533,7 @@ func Benchmark_Pool_Echo_Replaced(b *testing.B) { ctx, func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, NewPipeFactory(), - Config{ + PoolConfig{ NumWorkers: 1, MaxJobs: 1, AllocateTimeout: time.Second, diff --git a/supervisor_pool.go b/supervisor_pool.go index 43c36ae4..b354b493 100755 --- a/supervisor_pool.go +++ b/supervisor_pool.go @@ -92,7 +92,7 @@ func (sp *supervisedPool) AddListener(listener util.EventListener) { sp.pool.AddListener(listener) } -func (sp *supervisedPool) GetConfig() Config { +func (sp *supervisedPool) GetConfig() PoolConfig { return sp.pool.GetConfig() } diff --git a/supervisor_test.go b/supervisor_test.go index 34172d7d..08ea356d 100644 --- a/supervisor_test.go +++ b/supervisor_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" ) -var cfgSupervised = Config{ +var cfgSupervised = PoolConfig{ NumWorkers: int64(1), AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -69,7 +69,7 @@ func TestSupervisedPool_Exec(t *testing.T) { } func TestSupervisedPool_ExecTTL_TimedOut(t *testing.T) { - var cfgExecTTL = Config{ + var cfgExecTTL = PoolConfig{ NumWorkers: int64(1), AllocateTimeout: time.Second, DestroyTimeout: time.Second, @@ -109,7 +109,7 @@ func TestSupervisedPool_ExecTTL_TimedOut(t *testing.T) { } func TestSupervisedPool_ExecTTL_OK(t *testing.T) { - var cfgExecTTL = Config{ + var cfgExecTTL = PoolConfig{ NumWorkers: int64(1), AllocateTimeout: time.Second, DestroyTimeout: time.Second, |