Merge commit '2b11376411' into kb_migration

This commit is contained in:
KMY 2023-04-01 18:05:22 +09:00
commit ceec3a92cd
336 changed files with 4018 additions and 2492 deletions

View file

@ -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)

View file

@ -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