mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-08 05:43:51 -05:00
Move cache jobs to initializers
This commit is contained in:
@@ -1 +1 @@
|
||||
0.27.0
|
||||
0.27.1
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# 0.27.0 - 2025-05-31
|
||||
# 0.27.1 - 2025-06-01
|
||||
|
||||
## Fixed
|
||||
|
||||
- Cache jobs are now being scheduled correctly after app start.
|
||||
- `countries.geojson` now have fixed alpha codes for France and Norway
|
||||
|
||||
|
||||
|
||||
# 0.27.0 - 2025-06-01
|
||||
|
||||
⚠️ This release includes a breaking change. ⚠️
|
||||
|
||||
|
||||
@@ -5,12 +5,3 @@ require_relative 'application'
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
||||
# Use an atomic operation to ensure one-time execution
|
||||
if defined?(Rails::Server) && Rails.cache.write('cache_jobs_scheduled', true, unless_exist: true)
|
||||
# Clear the cache
|
||||
Cache::CleaningJob.perform_later
|
||||
|
||||
# Preheat the cache
|
||||
Cache::PreheatingJob.perform_later
|
||||
end
|
||||
|
||||
12
config/initializers/cache_jobs.rb
Normal file
12
config/initializers/cache_jobs.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.config.after_initialize do
|
||||
# Only run in server mode and ensure one-time execution with atomic write
|
||||
if defined?(Rails::Server) && Rails.cache.write('cache_jobs_scheduled', true, unless_exist: true)
|
||||
# Clear the cache
|
||||
Cache::CleaningJob.perform_later
|
||||
|
||||
# Preheat the cache
|
||||
Cache::PreheatingJob.perform_later
|
||||
end
|
||||
end
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user