Skip to content

Commit

Permalink
Merge branch 'main' into display-warning-if-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-truong-main authored Feb 6, 2024
2 parents 9c330b1 + 891566d commit 816000e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 34 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ gem 'icalendar', require: false
gem "jwt"
# Use Newrelic for logs and APM
gem "newrelic_rpm"
# Scheduling
gem 'rufus-scheduler'
# Used to manage periodic cron-like jobs
gem "clockwork"

Expand Down
9 changes: 0 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ GEM
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
execjs (2.9.1)
factory_bot (6.4.5)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -239,9 +237,6 @@ GEM
sanitize (< 7)
foreman (0.87.2)
formatador (1.1.0)
fugit (1.8.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
geocoder (1.8.2)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -437,7 +432,6 @@ GEM
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8)
rack-protection (3.1.0)
Expand Down Expand Up @@ -548,8 +542,6 @@ GEM
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
sanitize (6.1.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -725,7 +717,6 @@ DEPENDENCIES
rubocop
rubocop-performance
rubocop-rails (~> 2.23.1)
rufus-scheduler
sass-rails
shoulda-matchers (~> 6.1)
simple_form
Expand Down
12 changes: 12 additions & 0 deletions clock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ module Clockwork
puts "Running #{job}"
end

DATA_TYPES = %w[Distribution Purchase Donation]
every(1.day, "Cache historical data", at: "03:00") do
Organization.is_active.each do |org|
DATA_TYPES.each do |type|
Rails.logger.info("Queuing up #{type} cache data for #{org.name}")
HistoricalDataCacheJob.perform_later(org_id: org.id, type: type)
end
end

Rails.logger.info("Done!")
end

every(1.day, "Periodically reset seed data in staging", at: "00:00") do
if ENV["RAILS_ENV"] == "staging"
rake = Rake.application
Expand Down
7 changes: 0 additions & 7 deletions config/initializers/task_scheduler.rb

This file was deleted.

7 changes: 7 additions & 0 deletions db/migrate/20240202201155_cleanup_delayed_jobs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CleanupDelayedJobs < ActiveRecord::Migration[7.0]
def change
Delayed::Job.
where(locked_at: nil, failed_at: nil).
where("handler LIKE '%HistoricalDataCacheJob%'").delete_all
end
end
16 changes: 0 additions & 16 deletions lib/tasks/cache_historical_data.rake

This file was deleted.

0 comments on commit 816000e

Please sign in to comment.