dudleycarr/nsqjs — pull request #42 by zeevl (2014-11-12 21:20:32+00:00)
Title: pause / unpause fixes

Ok, I think I finally have things working correctly now.

There were a few issues:
- `reader.isPaused()` was referring to `readerrdy.pause`, a variable that was always `false`. changed it to check `readerrdy.current_state_name`
- In the test case you and I looked at monday evening, `reader.pause()` was getting called before the reader's connection was fully established. So I added a check for this state in the `connected` callback handler
- If we were paused but then called `finish()`, it would kick us out of pause. Added another check there.
- Ditto for `requeue`
- I added integration tests for each of the above items, that were formerly red but are now green.
- With all of these new integration tests running, the deleteTopic() method in integration_tests started hanging on the `post` to nsqd. This only happened when there were more than 2 of my new tests.. any combination of 3 would fail. Couldnt figure out what nsqd was hung up on, so instead I changed the suite to use different topics for each test.
- The `maxAttempts` setting was mis-documented as `maxRetries` -- corrected that as well.

While this is now working much better for my usage, please *review carefully*, especially the logic around backoff and balancing. I'm not at all sure that my changes cover all the scenarios you had in mind with this.

lmk if you have questions!
Steve