blob: 3e54326ba8b31b01c76059f7495f0aa54f0b33db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
module Chewy
class Strategy
class CustomSidekiq < Base
class Worker
include ::Sidekiq::Worker
sidekiq_options queue: 'pull'
def perform(type, ids, options = {})
options[:refresh] = !Chewy.disable_refresh_async if Chewy.disable_refresh_async
type.constantize.import!(ids, options)
end
end
def update(type, objects, _options = {})
return unless Chewy.enabled?
ids = type.root.id ? Array.wrap(objects) : type.adapter.identify(objects)
return if ids.empty?
Worker.perform_async(type.name, ids)
end
def leave; end
end
end
end
|