Merge commit '2b11376411
' into kb_migration
This commit is contained in:
commit
ceec3a92cd
336 changed files with 4018 additions and 2492 deletions
|
@ -3,7 +3,7 @@
|
|||
class PollExpirationNotifyWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options lock: :until_executed
|
||||
sidekiq_options lock: :until_executing
|
||||
|
||||
def perform(poll_id)
|
||||
@poll = Poll.find(poll_id)
|
||||
|
|
|
@ -6,17 +6,19 @@ class Scheduler::IndexingScheduler
|
|||
|
||||
sidekiq_options retry: 0
|
||||
|
||||
IMPORT_BATCH_SIZE = 1000
|
||||
SCAN_BATCH_SIZE = 10 * IMPORT_BATCH_SIZE
|
||||
|
||||
def perform
|
||||
return unless Chewy.enabled?
|
||||
|
||||
indexes.each do |type|
|
||||
with_redis do |redis|
|
||||
ids = redis.smembers("chewy:queue:#{type.name}")
|
||||
|
||||
type.import!(ids)
|
||||
|
||||
redis.pipelined do |pipeline|
|
||||
ids.each { |id| pipeline.srem("chewy:queue:#{type.name}", id) }
|
||||
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE).each_slice(IMPORT_BATCH_SIZE) do |ids|
|
||||
type.import!(ids)
|
||||
redis.pipelined do |pipeline|
|
||||
pipeline.srem("chewy:queue:#{type.name}", ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue