mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-07 07:26:20 +08:00
17 lines
486 B
Ruby
17 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
|