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 Timeout support #105

Merged
merged 2 commits into from
Oct 4, 2017

Conversation

mgates
Copy link
Contributor

@mgates mgates commented Oct 3, 2017

Ok, once more. This time we passed all of the options through from Etcdv3. We also turned some optional arguments into kwargs where it made sense (for internal methods only) and added a few extra tests.

@codecov
Copy link

codecov bot commented Oct 3, 2017

Codecov Report

Merging #105 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #105    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files           7      7            
  Lines         465    569   +104     
======================================
+ Hits          465    569   +104
Impacted Files Coverage Δ
spec/etcdv3/connection_wrapper_spec.rb 100% <100%> (ø) ⬆️
spec/etcdv3_spec.rb 100% <100%> (ø) ⬆️
spec/etcdv3/auth_spec.rb 100% <100%> (ø) ⬆️
spec/etcdv3/kv_spec.rb 100% <100%> (ø) ⬆️
spec/etcdv3/lease_spec.rb 100% <100%> (ø) ⬆️
spec/etcdv3/connection_spec.rb 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3789a35...1576ef1. Read the comment docs.

lib/etcdv3.rb Outdated
end

# Creates new user.
def user_add(user, password)
@conn.handle(:auth, 'user_add', [user, password])
def user_add(user, password, opts={})
Copy link
Owner

Choose a reason for hiding this comment

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

Given these methods are directly accessed by the user, we are going to want these to be as clear as possible. Users, for the most part, should know exactly what can and cannot be passed into these methods by looking at this file.

With that being said, where a method doesn't allow multiple options we should just specify timeout instead of opts so it's clear that there's not additional options that can be specified. If opts makes the most sense like the case of the get method, then we need to document the available options.

I hope that make sense!

lib/etcdv3.rb Outdated
end

def role_revoke_permission(name, permission, key, range_end='')
@conn.handle(:auth, 'role_revoke_permission', [name, permission, key, range_end])
def role_revoke_permission(name, permission, key, range_end='', opts={})
Copy link
Contributor

Choose a reason for hiding this comment

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

@davissp14 do you have strong feelings about changing range_end here? It's kind of goofy the way it is now that an options hash is being passed in. It would break backwards compatibility, but it might be better if the method definition looked like

def role_revoke_permission(name, permission, key, range_end: range_end, timeout: timeout)

The other nice thing is it would make it consistent with get and del.

Copy link
Owner

@davissp14 davissp14 Oct 4, 2017

Choose a reason for hiding this comment

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

You can certainly change that, not sure why I did that.

@mgates mgates force-pushed the add_deadline_support_to_etcdv3 branch 2 times, most recently from 311d773 to 181b28a Compare October 4, 2017 16:04
lib/etcdv3.rb Outdated
def put(key, value, lease_id: nil)
@conn.handle(:kv, 'put', [key, value, lease_id])
# key - string
# optional :lease - integer
Copy link
Owner

Choose a reason for hiding this comment

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

missing value here.

@davissp14
Copy link
Owner

Looks great guys. Let me know when you guys are wrapped up and i'll get this merged.

@davissp14
Copy link
Owner

On a side note, how do you guys feel about the global command timeout?

@mgates
Copy link
Contributor Author

mgates commented Oct 4, 2017

Like, the concept of it or having it set to 120 seconds. I'm kinda lukewarm on the concept of it, but don't feel strongly. I have no opinions at all about 120 seconds as default. It seems kinda high, but I don't wanna surprise current users with something that's much shorter (we're probably going to set it to something like half a second, which probably isn't what most people want).

@mgates mgates force-pushed the add_deadline_support_to_etcdv3 branch from 181b28a to 7044c1e Compare October 4, 2017 19:41
@davissp14
Copy link
Owner

Do you guys intend on using the global timeout, or primarily going to be leveraging request based timeouts?

@mgates
Copy link
Contributor Author

mgates commented Oct 4, 2017

I think probably the global one.

@davissp14
Copy link
Owner

Right on. Good to know.

@davissp14
Copy link
Owner

Aight, you ready for this to be merged?

@mgates
Copy link
Contributor Author

mgates commented Oct 4, 2017

I think we're good. Thanks for all the help.

@davissp14
Copy link
Owner

Thank you!

@davissp14 davissp14 merged commit 0c56807 into davissp14:master Oct 4, 2017
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