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

Unique jobs do not work with ActiveJob #56

Open
lucasteligioridis opened this issue Apr 11, 2021 · 6 comments
Open

Unique jobs do not work with ActiveJob #56

lucasteligioridis opened this issue Apr 11, 2021 · 6 comments

Comments

@lucasteligioridis
Copy link

lucasteligioridis commented Apr 11, 2021

Trying to do the below task in order to create unique jobs, as per:
https://github.com/contribsys/faktory/wiki/Pro-Unique-Jobs

My job classes look something like:

class FaktoryJob < ActiveJob::Base
  self.queue_adapter = :faktory
  queue_as 'default'
end

class SleepJob < FaktoryJob
  faktory_options custom: { unique_for: 5 }

  def perform
    sleep 10.seconds
  end
end

It seems that there might be an issue with the custom object being passed in correctly utilising ActiveJob vs native Faktory::Jobs
As you can see two identical jobs are enqueued immediately after one another:

Screen Shot 2021-04-12 at 8 41 48 am

@mperham
Copy link
Contributor

mperham commented Apr 15, 2021

I've updated the wiki page to note that uniqueness does not work with the ActiveJob wrapper.

@mperham mperham closed this as completed Apr 15, 2021
@lucasteligioridis
Copy link
Author

Is there any plans to support this? We're kind of relying on this feature in our stack.

@mperham
Copy link
Contributor

mperham commented Apr 15, 2021

Can you use Faktory::Job? It has the exact same perform_later API.

@lucasteligioridis
Copy link
Author

I'll speak to the team in regards to this, we were just hoping for a happy plug and play moment.
Might be okay to just use Faktory::Job directly in this case though.

@mperham
Copy link
Contributor

mperham commented Apr 15, 2021

Unfortunately the fix is not easy. I will keep this open.

@mperham mperham reopened this Apr 15, 2021
@mperham mperham changed the title Unable to pass custom parameters in faktory_options with ActiveJob Unique jobs do not work with ActiveJob Apr 15, 2021
@lucasteligioridis
Copy link
Author

No problem 👍🏼
Thanks mate :)

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

No branches or pull requests

2 participants