mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 23:21:30 +08:00
23 lines
636 B
Ruby
23 lines
636 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
|