diff options
author | Valery Piashchynski <[email protected]> | 2020-12-03 14:11:40 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-03 14:11:40 +0300 |
commit | c5aa774e5ad961929b4dfbe16f48a3747e2190a6 (patch) | |
tree | 713509d954f6ba91c573dd35adda38e532300d3d /plugins/checker/plugin.go | |
parent | dbcd8647d878abff04636f77eed87243b3758abb (diff) |
Add status request to the test
Diffstat (limited to 'plugins/checker/plugin.go')
-rw-r--r-- | plugins/checker/plugin.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/checker/plugin.go b/plugins/checker/plugin.go index 9f4c1fd8..c72cc615 100644 --- a/plugins/checker/plugin.go +++ b/plugins/checker/plugin.go @@ -3,6 +3,7 @@ package checker import ( "fmt" "net/http" + "time" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/logger" @@ -36,10 +37,13 @@ func (c *Plugin) Init(log log.Logger, cfg config.Configurer) error { return nil } -// localhost:88294/status/all func (c *Plugin) Serve() chan error { errCh := make(chan error, 1) - c.server = fiber.New() + c.server = fiber.New(fiber.Config{ + ReadTimeout: time.Second * 5, + WriteTimeout: time.Second * 5, + IdleTimeout: time.Second * 5, + }) c.server.Group("/v1", c.healthHandler) c.server.Use(logger.New()) c.server.Use("/health", c.healthHandler) @@ -55,7 +59,12 @@ func (c *Plugin) Serve() chan error { } func (c *Plugin) Stop() error { - return c.server.Shutdown() + const op = errors.Op("checker stop") + err := c.server.Shutdown() + if err != nil { + return errors.E(op, err) + } + return nil } // Reset named service. |