Skip to content

Delayed Sidekiq strategy errors by passing invalid Array type to redis client #971

@arinhouck

Description

@arinhouck

I am trying to import using the Delayed sidekiq strategy. However I am getting a redis client error for passing an invalid array type. From readings on other repository issues this seems to be a common case with gems integrated with redis commands which pass nested arrays to sadd call.


Expected behavior

I would expect it to kick off a redis job for sidekiq but it errors.

Actual behavior

The stacktrace throws an error from redis-client. See here someone else had come across this similar error for sidekiq-batch gem that had to be fixed to pass the correct format.

Stacktrace

TypeError: Unsupported command argument type: Array
from /Users/myuser/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.22.2/lib/redis_client/command_builder.rb:39:in `block in generate'

This issue seemed to bubble up to this LUA script call here.

Steps to reproduce the problem

I setup with the standard delayed sidekiq settings

Chewy.settings = {
  strategy_config: {
    delayed_sidekiq: {
      latency: 3,
      margin: 2,
      ttl: 60 * 60 * 24
    }
  }
}

You can reproduce by:

ProductsIndex.import!([1], strategy: :delayed_sidekiq)

Or even more specific I was diagnosing the call further down the stack to validate the inputs were correct.

Chewy::Strategy::DelayedSidekiq::Scheduler.new(ProductsIndex, [1]).postpone

This is only applicable on 8.0.0.pre.beta tag.

Version Information

Share here essential version information such as:

  • Chewy version: 8.0.0.pre.beta (commit = 6a2176f)
  • Elasticsearch version: 8.5.1
  • Ruby version: 3.1.2
  • Rails version: 6.1.7.9
  • Redis gem version: 4.2.0, 4.8.1, and 5.0.2 (latest)

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