@@ -20,6 +20,7 @@ const Usage = `
2020 [--max-attempts n] [--max-in-flight n]
2121 [--lookupd-http-address addr...]
2222 [--redis-address addr]
23+ [--idle-timeout t]
2324 [--list name] [--list-size n]
2425 [--publish name]
2526 [--level name]
@@ -32,6 +33,7 @@ const Usage = `
3233 --redis-address addr redis address [default: :6379]
3334 --max-attempts n nsq max message attempts [default: 5]
3435 --max-in-flight n nsq messages in-flight [default: 250]
36+ --idle-timeout t idle connection timeout [default: 1m]
3537 --list-size n redis list size [default: 100]
3638 --list name redis list template
3739 --publish name redis channel template
@@ -56,10 +58,16 @@ func main() {
5658 broadcast := broadcast .New ()
5759 config := config (args )
5860
61+ idleTimeout , err := time .ParseDuration (args ["--idle-timeout" ].(string ))
62+ if err != nil {
63+ log .Fatalf ("error parsing idle timeout: %s" , err )
64+ }
65+
5966 redis := redis .NewClient (& redis.Options {
6067 Network : "tcp" ,
6168 Addr : args ["--redis-address" ].(string ),
6269 DialTimeout : 10 * time .Second ,
70+ IdleTimeout : idleTimeout ,
6371 })
6472
6573 consumer , err := nsq .NewConsumer (topic , channel , config )
0 commit comments