Move cache cleaning to a job

This commit is contained in:
Eugene Burmakin 2024-12-24 17:01:26 +01:00
parent 2eb96bcdf1
commit 0dfdeac5c5
3 changed files with 12 additions and 3 deletions

View file

@ -28,8 +28,8 @@ jobs:
- run: - run:
name: Database Setup name: Database Setup
command: | command: |
bundle exec bin/rails db:create bundle exec rails db:create
bundle exec bin/rails db:schema:load bundle exec rails db:schema:load
- run: - run:
name: Run RSpec tests name: Run RSpec tests
command: bundle exec rspec command: bundle exec rspec

9
app/jobs/cache/cleaning_job.rb vendored Normal file
View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class Cache::CleaningJob < ApplicationJob
queue_as :default
def perform
Cache::Clean.call
end
end

View file

@ -7,7 +7,7 @@ require_relative 'application'
Rails.application.initialize! Rails.application.initialize!
# Clear the cache # Clear the cache
Cache::Clean.call Cache::CleaningJob.perform_later
# Preheat the cache # Preheat the cache
Cache::PreheatingJob.perform_later Cache::PreheatingJob.perform_later