-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fixes/error no members handling #36
Changes from 4 commits
14618ea
ca5a087
de29a8d
128c611
9d8cdc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,17 @@ defmodule Riak.CRDT.Counter do | |
@doc """ | ||
Increment a `counter` on the `amount` defaulting in 1 | ||
""" | ||
def increment(counter, amount \\ 1) when Record.is_record(counter, :counter) do | ||
def increment(counter, amount \\ 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this additional increment def, and the decrement below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It prevents from having a warning at compile time on that function because it has default value for the 'amount' param and several clauses. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, 👍 |
||
def increment(counter, amount) when Record.is_record(counter, :counter) do | ||
:riakc_counter.increment(amount, counter) | ||
end | ||
def increment(nil, _), do: {:error, :nil_object} | ||
|
||
@doc """ | ||
Decrement a `counter` on the `amount` defaulting in 1 | ||
""" | ||
def decrement(counter, amount \\ 1) when Record.is_record(counter, :counter) do | ||
def decrement(counter, amount \\ 1) | ||
def decrement(counter, amount) when Record.is_record(counter, :counter) do | ||
:riakc_counter.increment(-amount, counter) | ||
end | ||
def decrement(nil, _), do: {:error, :nil_object} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the timeout mechanism in place, it doesn't seem like we need to mess with the random number seed anymore right? Or were you leaving this here so that the downstream pooler stuff benefits it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you are right! I'll remove it.