summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/roadrunner.go18
-rw-r--r--lib/roadrunner_test.go9
2 files changed, 11 insertions, 16 deletions
diff --git a/lib/roadrunner.go b/lib/roadrunner.go
index 8a505c3f..d500dc66 100644
--- a/lib/roadrunner.go
+++ b/lib/roadrunner.go
@@ -5,8 +5,7 @@ import (
"runtime/debug"
configImpl "github.com/roadrunner-server/config/v3"
- endure "github.com/roadrunner-server/endure/pkg/container"
- "github.com/roadrunner-server/endure/pkg/fsm"
+ "github.com/roadrunner-server/endure/v2"
"github.com/roadrunner-server/roadrunner/v2/container"
)
@@ -38,11 +37,16 @@ func NewRR(cfgFile string, override []string, pluginList []any) (*RR, error) {
}
// create endure container
- endureContainer, err := container.NewContainer(*containerCfg)
- if err != nil {
- return nil, err
+ endureOptions := []endure.Options{
+ endure.GracefulShutdownTimeout(containerCfg.GracePeriod),
}
+ if containerCfg.PrintGraph {
+ endureOptions = append(endureOptions, endure.Visualize())
+ }
+
+ endureContainer := endure.New(containerCfg.LogLevel, endureOptions...)
+
// register another container plugins
err = endureContainer.RegisterAll(append(pluginList, cfg)...)
if err != nil {
@@ -79,8 +83,8 @@ func (rr *RR) Serve() error {
}
}
-func (rr *RR) CurrentState() fsm.State {
- return rr.container.CurrentState()
+func (rr *RR) Plugins() []string {
+ return rr.container.Plugins()
}
// Stop stops roadrunner
diff --git a/lib/roadrunner_test.go b/lib/roadrunner_test.go
index 9ed7c80a..d25e7380 100644
--- a/lib/roadrunner_test.go
+++ b/lib/roadrunner_test.go
@@ -5,7 +5,6 @@ import (
"testing"
"time"
- "github.com/roadrunner-server/endure/pkg/fsm"
"github.com/roadrunner-server/informer/v3"
"github.com/roadrunner-server/resetter/v3"
"github.com/roadrunner-server/roadrunner/v2/lib"
@@ -40,7 +39,6 @@ func TestNewWithConfig(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "2", string(rr.Version[0]))
- assert.Equal(t, fsm.Initialized, rr.CurrentState())
t.Cleanup(func() {
_ = os.Remove(cfgFile)
@@ -64,16 +62,9 @@ func TestServeStop(t *testing.T) {
stopchan <- struct{}{}
}()
- assert.Equal(t, rr.CurrentState(), fsm.Initialized)
-
- for rr.CurrentState() != fsm.Started {
- time.Sleep(20 * time.Millisecond)
- }
-
rr.Stop()
time.Sleep(time.Second * 2)
- assert.Equal(t, fsm.Stopped, rr.CurrentState())
assert.Equal(t, struct{}{}, <-stopchan)
assert.Nil(t, <-errchan)