chronomodel icon indicating copy to clipboard operation
chronomodel copied to clipboard

`find_each`, `find_in_batches` batch processing not honored in history model

Open tagliala opened this issue 1 year ago • 2 comments

(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

tagliala avatar Sep 28 '22 15:09 tagliala

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

tagliala avatar Oct 01 '22 08:10 tagliala

Not solved yet

tagliala avatar Oct 20 '22 13:10 tagliala