chronomodel
chronomodel copied to clipboard
`find_each`, `find_in_batches` batch processing not honored in history model
(byebug) Activity.count
193
(byebug) Activity.history.count
1632
(byebug) Activity.find_each(batch_size: 10).count
193
(byebug) Activity.history.find_each(batch_size: 10).count
10
Both errors are caused to in_batches
using id
instead of hid
Activity::History Pluck (1.1ms) SELECT "history"."activities"."id" FROM "history"."activities" ORDER BY "history"."activities"."id" ASC LIMIT $1 [["LIMIT", 5]]
Activity.in_batches(of: 5).map(&:count).uniq.all? { |c| c <= 5 }
=> true
Activity.history.in_batches(of: 5).map(&:count).uniq.all? { |c| c <= 5 }
=> false
Not solved yet