mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 06:21:42 +01:00
parent
280fa3b2c0
commit
d5ad8b6422
1 changed files with 4 additions and 6 deletions
|
@ -14,12 +14,10 @@ class Scheduler::IndexingScheduler
|
||||||
|
|
||||||
indexes.each do |type|
|
indexes.each do |type|
|
||||||
with_redis do |redis|
|
with_redis do |redis|
|
||||||
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE) do |ids|
|
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE).each_slice(IMPORT_BATCH_SIZE) do |ids|
|
||||||
redis.pipelined do
|
type.import!(ids)
|
||||||
ids.each_slice(IMPORT_BATCH_SIZE) do |slice_ids|
|
redis.pipelined do |pipeline|
|
||||||
type.import!(slice_ids)
|
pipeline.srem("chewy:queue:#{type.name}", ids)
|
||||||
redis.srem("chewy:queue:#{type.name}", slice_ids)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue