scinote-web/config/initializers/scheduler.rb
Martin Artnik dd2b33ddaf
Merge pull request #6654 from ivanscinote/SCI-9636-IK
Add notification cleanup job [SCI-9636]
2023-11-27 17:48:27 +01:00

32 lines
819 B
Ruby

# frozen_string_literal: true
require 'rufus-scheduler'
scheduler = Rufus::Scheduler.singleton
if ENV['ENABLE_TEMPLATES_SYNC'] == 'true'
# Templates sync periodic task
scheduler.every '12h' do
Rails.logger.info('Templates, syncing all template projects')
updated, total = TemplatesService.new.update_all_templates
Rails.logger.info(
"Templates, total number of updated projects: #{updated} out of #{total}}"
)
Rails.logger.flush
end
end
if ENV['ENABLE_FLUICS_SYNC'] == 'true'
scheduler.every '24h' do
LabelPrinters::Fluics::SyncService.new.sync_templates! if LabelPrinter.fluics.any?
end
end
scheduler.every '1h' do
MyModules::DueDateReminderJob.perform_now
RepositoryItemDateReminderJob.perform_now
end
scheduler.every '1d' do
NotificationCleanupJob.perform_now
end