- Removed conditional check for production environment in the initializer to ensure the sitemap refresh worker always runs at startup. - Renamed Sidekiq configuration file from sidekiq.yml to sidekiq_scheduler.yml to better reflect its purpose. These changes streamline the initialization process for scheduled tasks and enhance the clarity of the configuration files used in the project.
10 lines
308 B
Ruby
10 lines
308 B
Ruby
# config/initializers/schedule_tasks.rb
|
|
Rails.application.config.after_initialize do
|
|
begin
|
|
RefreshSitemapWorker.perform_async
|
|
Rails.logger.info "Startup task (RefreshSitemapWorker) scheduled successfully"
|
|
rescue => e
|
|
Rails.logger.error "Error scheduling startup task: #{e.message}"
|
|
end
|
|
end
|