From e475aaf5389a28efda9b1685c61b0b558b5708f4 Mon Sep 17 00:00:00 2001 From: Alp Aker Date: Wed, 15 Aug 2018 09:18:01 -0400 Subject: [PATCH] apps/nsq_to_file: New flag -rotate-check-interval FileLogger checks whether a file should be rotated every rotate-check-interval duration (default 30s). --- apps/nsq_to_file/file_logger.go | 2 +- apps/nsq_to_file/nsq_to_file.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/nsq_to_file/file_logger.go b/apps/nsq_to_file/file_logger.go index 6c13c60c1..739525339 100644 --- a/apps/nsq_to_file/file_logger.go +++ b/apps/nsq_to_file/file_logger.go @@ -82,7 +82,7 @@ func (f *FileLogger) router(r *nsq.Consumer) { pos := 0 output := make([]*nsq.Message, *maxInFlight) sync := false - ticker := time.NewTicker(time.Duration(30) * time.Second) + ticker := time.NewTicker(*rotateCheckInterval) closing := false closeFile := false exit := false diff --git a/apps/nsq_to_file/nsq_to_file.go b/apps/nsq_to_file/nsq_to_file.go index 7ba473699..74715cef2 100644 --- a/apps/nsq_to_file/nsq_to_file.go +++ b/apps/nsq_to_file/nsq_to_file.go @@ -34,6 +34,7 @@ var ( rotateSize = flag.Int64("rotate-size", 0, "rotate the file when it grows bigger than `rotate-size` bytes") rotateInterval = flag.Duration("rotate-interval", 0*time.Second, "rotate the file every duration") + rotateCheckInterval = flag.Duration("rotate-check-interval", 30*time.Second, "check whether the file should be rotated every duration") httpConnectTimeout = flag.Duration("http-client-connect-timeout", 2*time.Second, "timeout for HTTP connect") httpRequestTimeout = flag.Duration("http-client-request-timeout", 5*time.Second, "timeout for HTTP request")