Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Unique jobs ? #40

Open
lephyrius opened this issue Feb 19, 2017 · 1 comment
Open

Unique jobs ? #40

lephyrius opened this issue Feb 19, 2017 · 1 comment

Comments

@lephyrius
Copy link

Is there a way to add unique jobs so you cannot requeue another of the the same job like in:
https://github.com/mhenrixon/sidekiq-unique-jobs ?

@jessedijkstra
Copy link

jessedijkstra commented Oct 28, 2017

It is possible to write this yourself when you dig a little into the API:

  defp has_job?(arguments), do: Enum.any?(jobs(), &(&1 == arguments))

  defp jobs() do
    Toniq.JobPersistence.jobs
    |> Enum.filter(&(&1.worker == Worker))
    |> Enum.map(&(&1.arguments))
  end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants