summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-23 00:23:55 +0300
committerValery Piashchynski <[email protected]>2020-12-23 00:23:55 +0300
commit83c85ba90d65918e54b81e44bd43f7f5b5e8b557 (patch)
tree04f370f2c28c6176f8ac3c4775fab9b67b2120ab /cmd
parent1f6749ed4cf3cfd2beade4949945a382abd66b15 (diff)
Fix golangci liters
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cli/root.go2
-rw-r--r--cmd/cli/workers.go12
2 files changed, 9 insertions, 5 deletions
diff --git a/cmd/cli/root.go b/cmd/cli/root.go
index b070ca5e..00d192f6 100644
--- a/cmd/cli/root.go
+++ b/cmd/cli/root.go
@@ -45,7 +45,7 @@ func init() {
// todo: properly handle debug level
Logger = initLogger()
- //endureLogger := logger.NewZapAdapter(Logger)
+ // endureLogger := logger.NewZapAdapter(Logger)
cobra.OnInitialize(func() {
if CfgFile != "" {
diff --git a/cmd/cli/workers.go b/cmd/cli/workers.go
index e031ac6c..e9c8ab2c 100644
--- a/cmd/cli/workers.go
+++ b/cmd/cli/workers.go
@@ -9,7 +9,9 @@ import (
"time"
tm "github.com/buger/goterm"
+ "github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/tools"
+ "go.uber.org/zap"
"github.com/fatih/color"
"github.com/spf13/cobra"
@@ -43,6 +45,7 @@ func init() {
}
func workersHandler(cmd *cobra.Command, args []string) error {
+ const op = errors.Op("workers handler")
client, err := RPCClient()
if err != nil {
return err
@@ -50,7 +53,7 @@ func workersHandler(cmd *cobra.Command, args []string) error {
defer func() {
err := client.Close()
if err != nil {
- Logger.Error(err.Error())
+ Logger.Error("error when closing RPCClient", zap.Error(err))
}
}()
@@ -75,7 +78,10 @@ func workersHandler(cmd *cobra.Command, args []string) error {
return nil
case <-time.NewTicker(time.Second).C:
tm.MoveCursor(1, 1)
- showWorkers(plugins, client)
+ err := showWorkers(plugins, client)
+ if err != nil {
+ return errors.E(op, err)
+ }
tm.Flush()
}
}
@@ -97,12 +103,10 @@ func showWorkers(plugins []string, client *rpc.Client) error {
ps[i].MemoryUsage = list.Workers[i].MemoryUsage
ps[i].Pid = list.Workers[i].Pid
ps[i].Status = list.Workers[i].Status
-
}
fmt.Printf("Workers of [%s]:\n", color.HiYellowString(plugin))
tools.WorkerTable(os.Stdout, ps).Render()
}
-
return nil
}