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

use direct method replacement for the redis patcher #56

Merged
merged 1 commit into from
Jan 17, 2017

Conversation

galdor
Copy link
Contributor

@galdor galdor commented Jan 13, 2017

Adding ancestors to the redis client class will sometimes lead to
infinite recursion if call/call_pipeline have been monkey patched by
external code.

Copy link
Contributor

@ufoot ufoot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, were we finally able to reproduce the problem and assert this fixes it? If yes, we probably wish to write a test to make sure it stays fixed. Might be complex but still, probably useful as this kind of interaction is hard to spot.

end
end

@patched = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather leave the @patched = true section in the caller, as patch_redis_client is only part of the global patching process, and calling it alone won't patch properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't intended, thank you for pointing it out :)

@galdor galdor force-pushed the nicolas/infinite-recursion branch 2 times, most recently from 43d216a to 31662e1 Compare January 16, 2017 14:20
Adding ancestors to the redis client class will sometimes lead to
infinite recursion if call/call_pipeline have been monkey patched  by
external code.
def call(*args, &block)
@datadog_test_called ||= false
if @datadog_test_called
raise Minitest::Assertion, 'patched methods called in infinite loop'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@galdor galdor merged commit b9ef1be into master Jan 17, 2017
@galdor galdor deleted the nicolas/infinite-recursion branch January 17, 2017 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants