Skip to content

Concurrency key doesn't handle Hash: TypeError (can't cast Hash) #784

Closed
@Earlopain

Description

As the title says. The job arguments are serialized by ActiveJob to something the database understands but the same is not true for the concurrency key.

class ExampleJob < ApplicationJob
  include GoodJob::ActiveJobExtensions::Concurrency
  good_job_control_concurrency_with(total_limit: 1, key: -> { arguments.first })

  def perform(arg)
  end
end

Job.new.perform({a: "test"})
# => All good
Job.perform_later({a: "test"})
# => Failed enqueuing Job to GoodJob(queue): TypeError (can't cast Hash)

Not sure if what I was trying to do should even be supported, but the error message I get as a result of doing this is not very clear and lead me to believe that the issues was with the parameters I was passing to the job.

Edit: Updated the issue description after figuring out what was actually going on.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions