houdini/lib/tasks/full_contact.rake
2020-06-15 10:26:57 -05:00

19 lines
569 B
Ruby

# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
desc 'For generating Full Contact data'
# Clear old activerecord sessions tables daily
task work_full_contact_queue: :environment do
loop do
sleep(10) until Qx.select('COUNT(*)').from('full_contact_jobs').execute.first['count'] > 0
puts 'working...'
begin
InsertFullContactInfos.work_queue
rescue Exception => e
puts "Exception thrown: #{e}"
end
end
end