fix(after_party): remove APP_ENV condition

This commit is contained in:
François Vantomme 2022-03-11 16:16:43 +01:00 committed by simon lehericey
parent 93233be5c9
commit b89541568c

View file

@ -3,21 +3,19 @@ namespace :after_party do
task process_expired_dossiers_en_construction: :environment do
puts "Running deploy task 'process_expired_dossiers_en_construction'"
if ENV['APP_NAME'] == 'tps'
dossiers_close_to_expiration = Dossier
.en_construction_close_to_expiration
.without_en_construction_expiration_notice_sent
dossiers_close_to_expiration = Dossier
.en_construction_close_to_expiration
.without_en_construction_expiration_notice_sent
ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration, :en_construction_close_to_expiration_notice_sent_at)
ExpiredDossiersDeletionService.send_expiration_notices(dossiers_close_to_expiration, :en_construction_close_to_expiration_notice_sent_at)
BATCH_SIZE = 1000
BATCH_SIZE = 1000
((dossiers_close_to_expiration.count / BATCH_SIZE).ceil + 1).times do |n|
dossiers_close_to_expiration
.offset(n * BATCH_SIZE)
.limit(BATCH_SIZE)
.update_all(en_construction_close_to_expiration_notice_sent_at: Time.zone.now + n.days)
end
((dossiers_close_to_expiration.count / BATCH_SIZE).ceil + 1).times do |n|
dossiers_close_to_expiration
.offset(n * BATCH_SIZE)
.limit(BATCH_SIZE)
.update_all(en_construction_close_to_expiration_notice_sent_at: Time.zone.now + n.days)
end
# Update task as completed. If you remove the line below, the task will