toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 364 forks source link

Deprecated the `zrangebyscore` command #928

Open rizrei opened 6 months ago

rizrei commented 6 months ago

In our project, we decided to try to use the delayed_sidekiq strategy and encountered the following problems:

  1. Create User records with the delayed_sidekiq strategy

    Chewy.strategy(:delayed_sidekiq) { 3.times { |i| FactoryBot.create(:user, email: "delayed_sidekiq#{i}@mail.com") } }

    The following error appears in the sidekiq logs:

    [sidekiq#5788] Redis has deprecated the `zrangebyscore` command, called at ["/Users/r1zrei/.rvm/gems/ruby-2.7.2@product-x/gems/chewy-7.3.3/lib/chewy/ strategy/delayed_sidekiq/worker.rb:14:in `block in perform'"]

    redis doc I replaced this line lib/chewy/strategy/delayed_sidekiq/worker.rb:14 with

    timechunk_keys = redis.zrange(timechunks_key, -1, score, byscore: true)
  2. To store data we use a postgres database, where primary_key is in uuid format lib/chewy/strategy/delayed_sidekiq/worker.rb:47 in this place the id is converted to integer, as a result, importing new index does not work

    "d2ab25ce-3ec4-49f9-8e53-78665ac0a568".to_i # 0
    UsersIndex.import 0