fix(champs): use approximate count in the task
This commit is contained in:
parent
a60bc5d630
commit
750b38bbf4
1 changed files with 6 additions and 1 deletions
|
@ -3,11 +3,16 @@
|
|||
module Maintenance
|
||||
class FillChampsStableIdTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
Champ.includes(:type_de_champ)
|
||||
Champ.where(stable_id: nil).includes(:type_de_champ)
|
||||
end
|
||||
|
||||
def process(champ)
|
||||
champ.update_columns(stable_id: champ.stable_id, stream: 'main')
|
||||
end
|
||||
|
||||
def count
|
||||
sql = "SELECT reltuples FROM pg_class WHERE relname = 'champs';"
|
||||
Champ.connection.select_value(sql).to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue