Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request id fix for bulk publishes #154

Merged
merged 9 commits into from
May 1, 2018

Conversation

mattheworiordan
Copy link
Member

Unfortunately @funkyboy's implementation did not have test coverage with the new request ID for publish operations, and such, his work introduced a regression.

This PR fixes that, but also:

  • Improves those tests marginally
  • Fixes a few incorrect calls to potentially private method
  • Adds a shared logger for inspecting log output
  • Always logs the outcomes of retry requests. I believe this will significantly help people when debugging requests that are retried as the logs will make more sense.

params is the body for the #send_request method when the very is POST/PUT, so the previous code failed with all non-GET requests
Most of the tests were checking that the @request_id param is equal to the request_id in the exception for example.  But at no point are we checking that the request_id itself is valid i.e. it could be `nil` and all the tests would pass.
Example warnings emitted for a request that fails but then succeeds is now:

```
warn: Ably::Rest::Client - Retry 1 for get /time {} as initial attempt failed (seq #5g-tSQ): getaddrinfo: nodename nor servname provided, or not known (SocketError)
warn: Ably::Rest::Client - Request SUCCEEDED after 1 retry for get /time {} (seq #5g-tSQ, time elapsed 5.11s)
```

And a request that never succeeds:

```
warn: Ably::Rest::Client - Retry 1 for get /time {} as initial attempt failed (seq #KyefoA): getaddrinfo: nodename nor servname provided, or not known (SocketError)
warn: Ably::Rest::Client - Retry 2 for get /time {} as initial attempt failed (seq #KyefoA): getaddrinfo: nodename nor servname provided, or not known (SocketError)
error: Ably::Rest::Client - Request FAILED after 2 retries for get /time {} (seq #KyefoA, time elapsed 15.02s)
```

See related https://github.com/ably/docs/issues/359
Mixing the test debug failure logger and this new logger is causing unreliable tests when using the new test logger.
This implementation is complete with support for blocks and the other logger is now disabled for these tests.
We can get more than 2 warnings, but we will have at least two
@mattheworiordan mattheworiordan force-pushed the add-request-id-fix-for-bulk-publishes branch from 5a060c3 to 58d0bf0 Compare May 1, 2018 00:03
@mattheworiordan mattheworiordan merged commit 58d0bf0 into master May 1, 2018
@mattheworiordan mattheworiordan deleted the add-request-id-fix-for-bulk-publishes branch May 1, 2018 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant