Skip to content

recurring task argument not successfully passing all ActiveJob supported types #183

Closed as not planned
@hms

Description

@hms

I ran into a problem with passing an ActiveSupport::Duration to a recurring job.

I built a couple of jobs that just pass arguments and check that they are received as the expected types. I tested each of the supported type described on the Rails guides Active Job Basics.

  • I was unable to successfully pass any ActiveSupport supported datatypes: TimeWithZone, Duration, or HasWithIndifferentAccess. I tried positional and kwargs and regardless of how I attempted to pass the argument, they are received by the job as a string.
  • I was unable to figure out pass a symbol as an argument in any permutation: arg: :sym, arg: ":sym", arg: 'sym'.to_sym
  • I made a quick test with an ActiveJob custom serializer, but my custom types where also being processed as strings.

Sample solid_queue.yml:

default: &default
  dispatchers:
    - polling_interval: 1
      batch_size: 500
      recurring_tasks:
        rails_types_job:
          class: RailsTypesJob
          args: [ 10.minutes, { twt: Time.current, duration: 10.minutes } ]
          schedule: every 1 minute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions