Add OperationsSignatureJob

This commit is contained in:
Nicolas Bouilleaud 2019-06-04 10:37:05 +02:00
parent ad3553f0be
commit 925edb01c7
2 changed files with 16 additions and 0 deletions

View file

@ -70,6 +70,7 @@ En local, un utilisateur de test est créé automatiquement, avec les identifian
WarnExpiringDossiersJob.set(cron: "0 0 1 * *").perform_later WarnExpiringDossiersJob.set(cron: "0 0 1 * *").perform_later
GestionnaireEmailNotificationJob.set(cron: "0 10 * * 1,2,3,4,5,6").perform_later GestionnaireEmailNotificationJob.set(cron: "0 10 * * 1,2,3,4,5,6").perform_later
PurgeUnattachedBlobsJob.set(cron: "0 0 * * *").perform_later PurgeUnattachedBlobsJob.set(cron: "0 0 * * *").perform_later
OperationsSignatureJob.set(cron: "0 6 * * *").perform_later
### Voir les emails envoyés en local ### Voir les emails envoyés en local

View file

@ -0,0 +1,15 @@
class OperationsSignatureJob < ApplicationJob
queue_as :cron
def perform(*args)
last_midnight = Time.zone.today.beginning_of_day
operations_by_day = BillSignatureService.grouped_unsigned_operation_until(last_midnight)
operations_by_day.each do |day, operations|
begin
BillSignatureService.sign_operations(operations, day)
rescue
raise # let errors show up on Sentry and delayed_jobs
end
end
end
end