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

Change Verk.Queue, Verk.RetrySet, Verk.SortedSet to have clear!/clear, range!/range... #49

Closed
edgurgel opened this issue Apr 10, 2016 · 4 comments
Milestone

Comments

@edgurgel
Copy link
Owner

These modules should offer "twins" of each function:

Example: clear! and clear where clear returns{:ok, something} or {:error, reason} and clear! will return something or throw an error.

This should be done soon as we don't want to break this API after we release 1.0.0

@edgurgel edgurgel added this to the 1.0.0 milestone Apr 10, 2016
@edgurgel edgurgel changed the title Change Verk.Queue, Verk.RetrySet, Verk.SortedSet to have clear!/clear, range!/range... Change Verk.Queue, Verk.RetrySet, Verk.SortedSet to have clear!/clear, range!/range... Apr 10, 2016
@krasio
Copy link
Collaborator

krasio commented Apr 14, 2016

Do you mean something simple like

  def count(queue) do
    Redix.command(Verk.Redis, ["LLEN", queue_name(queue)])
  end  

  def count!(queue) do
    case count(queue) do
      {:ok, resp} ->
        resp 
      {:error, error} ->
        raise error
    end  
  end

or something a little bit more elaborate like returning/raising Verk.Error instead of raw Redix.Error, etc...

@edgurgel
Copy link
Owner Author

It could be simple like that. We could even use a macro like this PR: https://github.com/ericmj/mongodb/pull/51/files the bangify!

@krasio
Copy link
Collaborator

krasio commented Apr 21, 2016

Can you please take a look and check am I on the right track - https://github.com/krasio/verk/commits/issues/49.

@edgurgel
Copy link
Owner Author

@krasio, that's exactly what I had in mind. Thank you very much! ❤️

krasio added a commit to krasio/verk that referenced this issue Apr 22, 2016
non-bang pairs for public methods.

Add macro to ease creating bang variants of functions.

Closes edgurgel#49.
krasio added a commit to krasio/verk that referenced this issue Apr 22, 2016
These modules now offer pair of bang and non-bang variants for their
public functions.

Add macro to ease creating bang variants of functions.

Closes edgurgel#49.
edgurgel pushed a commit that referenced this issue Apr 22, 2016
These modules now offer pair of bang and non-bang variants for their
public functions.

Add macro to ease creating bang variants of functions.

Closes #49.
edgurgel added a commit to edgurgel/verk_web that referenced this issue May 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants