Log deleted contacts to file, don't send poll message on initial cycle

This commit is contained in:
Karl Erik Õunapuu 2020-09-16 11:13:50 +03:00
parent ab1fa9064e
commit 7e9a3250bd
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 17 additions and 4 deletions

View file

@ -1,9 +1,9 @@
namespace :contacts do
desc 'Archives inactive contacts'
task :archive, [:track_id] => [:environment] do |_t, args|
task :archive, %i[track_id initial_run] => [:environment] do |_t, args|
unlinked_contacts = contacts_start_point(args[:track_id])
initial_run = args[:initial_run] == true || args[:initial_run] == 'true'
counter = 0
log("Found #{unlinked_contacts.count} unlinked contacts. Starting to archive.")
@ -11,7 +11,7 @@ namespace :contacts do
next unless contact.archivable?
log("Archiving contact: id(#{contact.id}), code(#{contact.code})")
contact.archive(verified: true)
contact.archive(verified: true, notify: !initial_run, extra_log: initial_run)
counter += 1
end