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

Initialize redis on connection pool #32

Merged
merged 9 commits into from
Jul 20, 2020

Conversation

lorenzograndi4
Copy link
Contributor

Copy link
Contributor

@julik julik left a comment

Choose a reason for hiding this comment

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

Great and expedient fix, thanks 🙏 I wonder though - do we need to duplicate all of our tests just to test the setup with two variants of the Redis argument? Can we be a bit terser and only test for that specific setup detail in a couple additional tests instead?

@lorenzograndi4
Copy link
Contributor Author

I only added one test atm. The rest of the throttling tests I simply wrapped in a context for clarity. Maybe there should be one more test for the initialization of the leakybucket class, I'll add that

@julik
Copy link
Contributor

julik commented Jul 20, 2020

Ah I see now! But should we create that much diff just for adding one context? Contexts imply that there will be multiple where different cases are covered, and here it is not the case.

The reason I am being so picky about it is that Prorate is somewhat complex to read/understand. Any extra stuff we add in tests contributes to that complexity.


context 'with a connection pool' do
it 'throttles and raises an exception' do
pool = ConnectionPool.new(size: 3, timeout: 3) { Redis.new }

Choose a reason for hiding this comment

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

you can use the r you set on line 25 here.

@julik
Copy link
Contributor

julik commented Jul 20, 2020

👍

@julik julik merged commit dac4d99 into master Jul 20, 2020
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