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

#good_job_labels retains values across job instances #1354

Closed
mhgoldman opened this issue May 22, 2024 · 3 comments · Fixed by #1355
Closed

#good_job_labels retains values across job instances #1354

mhgoldman opened this issue May 22, 2024 · 3 comments · Fixed by #1355

Comments

@mhgoldman
Copy link

mhgoldman commented May 22, 2024

Given the following job:

class TestJob < ApplicationJob
  include GoodJob::ActiveJobExtensions::Labels

  before_enqueue { |job| job.good_job_labels << Time.now.to_s }

  def perform
    puts "#{good_job_labels}"
  end
end

Each job I enqueue contains the labels of the job before:

TestJob.perform_later # => ["2024-05-22 01:42:36 +0000"]
TestJob.perform_later # => ["2024-05-22 01:42:36 +0000", "2024-05-22 01:42:40 +0000"]
TestJob.perform_later # => ["2024-05-22 01:42:36 +0000", "2024-05-22 01:42:40 +0000", "2024-05-22 01:42:41 +0000"]
@bensheldon
Copy link
Owner

ooh, thanks for the report. I think there needs to be a dup in here:

self.good_job_labels = Array(self.class.good_job_labels)

Let me try to make a quick repro test and fix.

@bensheldon
Copy link
Owner

Just released the fix for this: https://github.com/bensheldon/good_job/releases/tag/v3.29.2

@mhgoldman
Copy link
Author

Fantastic. Many thanks for all your efforts!!

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

Successfully merging a pull request may close this issue.

2 participants