segmentio / nsq.js

NSQ client for nodejs
203 stars 34 forks source link

don't reconnect if identify fails #41

Closed gjohnson closed 10 years ago

gjohnson commented 10 years ago

If you identify incorrectly, the nsqd server drops your connection. I think rather than reconnecting with the same bad values over and over, we should just bubble the error up.

14/09/05 10:22:05 CLIENT(192.168.1.3:59946): desired protocol magic '  V2'
2014/09/05 10:22:05 [192.168.1.3:59946] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:05 ERROR: [192.168.1.3:59946] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59946] exiting ioloop
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59946] exiting messagePump
2014/09/05 10:22:05 TCP: new client(192.168.1.3:59947)
2014/09/05 10:22:05 CLIENT(192.168.1.3:59947): desired protocol magic '  V2'
2014/09/05 10:22:05 [192.168.1.3:59947] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:05 ERROR: [192.168.1.3:59947] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59947] exiting ioloop
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59947] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59948)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59948): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59948] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59948] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59948] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59948] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59949)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59949): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59949] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59949] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59949] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59949] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59950)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59950): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59950] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59950] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59950] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59950] exiting messagePump
2014/09/05 10:22:06 LOOKUPD(0.0.0.0:4160): sending heartbeat
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59952)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59952): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59952] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59952] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59952] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59952] exiting messagePump
2014/09/05 10:22:21 LOOKUPD(0.0.0.0:4160): sending heartbeat
2014/09/05 10:22:36 LOOKUPD(0.0.0.0:4160): sending heartbeat
tj commented 10 years ago

oh shit, nice find

josueLy commented 2 years ago

what is the correct value when you try to set the timeout?