skip to Main Content

recently I have upgraded rails from 5.2 to 7.x and ruby 2.6 to 2.7.x and encouthering an issue with sidekiq job execution.

Getting ActiveSupport::Duration as an error message for any perform_later

I tried various ways to fix the issue but was struck to figure out the exact area of the failure. It perfectly works with Rails 7.x and ruby 2.7 with sidekiq 6.x version and fails only on the sidekiq 7.x version, so it seems like any API modification but failing to figure it.

Version details

Rails 7.0.4.2
ruby 2.7.7
Redis 5.0.6
sidekiq 7.0.6

3

Answers


  1. This is fixed on main, see issue 5806.

    Login or Signup to reply.
  2. @mike-perham here is a simple example, it looks like it is related to the sidekiq status gem:

    Ruby 3.2.1
    Rails 7.0.4.3
    Sidekiq 7.0.7
    Redis 5.0.6 (gem)
    sidekiq-status 3.0.1
    
    class TestJob
      include Sidekiq::Worker
      include Sidekiq::Status::Worker
    
      def perform()
      end
    end
    
    TestJob.perform_async()
    
    /usr/local/var/rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/redis-client-0.14.0/lib/redis_client/command_builder.rb:37:in `block in generate': Unsupported command argument type: ActiveSupport::Duration (TypeError)
    
                raise TypeError, "Unsupported command argument type: #{element.class}"
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    Login or Signup to reply.
  3. I had this same issue and for me, it turned out to be a breaking change that I wasn’t handling. I had

    SIDEKIQ_STATUS_EXPIRATION = 48.hours
    Sidekiq.configure_client do |config|
        config.redis = { url: Rails.application.secrets.redis_url }
        Sidekiq::Status.configure_client_middleware(config, 
                   expiration: SIDEKIQ_STATUS_EXPIRATION)
    end
    

    The first line was the object that was of type ActiveSupport::Duration. Changing that line to be an integer instead made the error disappear.

    SIDEKIQ_STATUS_EXPIRATION = 48.hours.to_i
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search