diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-11-27 14:57:36 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-11-27 14:57:36 +0000 |
| commit | c74bfb883c35b15883e4cb1356e8a52282b96971 (patch) | |
| tree | 7c10ce44eda3c971317ac45f1d4565e6de58fb46 /internal/clients | |
| parent | 45853f487830d5f74f2de81b5348ae6463096a57 (diff) | |
use global interrupt timeout setting for interrupt timeout
Diffstat (limited to 'internal/clients')
| -rw-r--r-- | internal/clients/stats.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/clients/stats.go b/internal/clients/stats.go index d5bcd2d..17343b5 100644 --- a/internal/clients/stats.go +++ b/internal/clients/stats.go @@ -8,6 +8,7 @@ import ( "sync" "time" + "github.com/mimecast/dtail/internal/config" "github.com/mimecast/dtail/internal/io/logger" ) @@ -62,7 +63,7 @@ func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, statsCh < switch force { case true: messages = append(messages, fmt.Sprintf("Connection stats: %s", stats)) - s.forcePrintStats(messages) + s.printStatsOnInterrupt(messages) default: logger.Info(stats) } @@ -74,12 +75,12 @@ func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, statsCh < } } -func (s *stats) forcePrintStats(messages []string) { +func (s *stats) printStatsOnInterrupt(messages []string) { logger.Pause() for _, message := range messages { - fmt.Println(fmt.Sprintf("\t%s", message)) + fmt.Println(fmt.Sprintf(" %s", message)) } - time.Sleep(time.Second * 3) + time.Sleep(time.Second * time.Duration(config.InterruptTimeoutS)) logger.Resume() } |
