mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
18 lines
486 B
Ruby
18 lines
486 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
require 'rufus-scheduler'
|
||
|
|
||
|
scheduler = Rufus::Scheduler.singleton
|
||
|
|
||
|
if ENV['ENABLE_TEMPLATES_SYNC'] && ARGV[0] == 'jobs:work'
|
||
|
# Templates sync periodic task
|
||
|
scheduler.every '1h' do
|
||
|
Rails.logger.info('Templates, syncing all template projects')
|
||
|
updated, total = TemplatesService.new.update_all_projects
|
||
|
Rails.logger.info(
|
||
|
"Templates, total number of updated projects: #{updated} out of #{total}}"
|
||
|
)
|
||
|
Rails.logger.flush
|
||
|
end
|
||
|
end
|