Skip to content

Commit

Permalink
only try to schedule jobs if redis is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 25, 2024
1 parent 8439bef commit 1d78fb7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/lib/usage_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def self.generate
end

def self.set_schedule!
return if ENV.fetch("REDIS_URL", nil)
SiteSettings.clear_cache
jobname = "usage"
if SiteSettings.anonymous_usage_id.present?
Expand Down
3 changes: 1 addition & 2 deletions config/initializers/shrine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
name: "clear-shrine-cache",
cron: "every hour",
class: "CacheSweepJob"
)
rescue RedisClient::CannotConnectError
) unless ENV.fetch("REDIS_URL", nil)
end
end
1 change: 0 additions & 1 deletion config/initializers/usage_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
Rails.application.config.after_initialize do
# Make sure the schedule is loaded correctly
UsageReport.set_schedule!
rescue RedisClient::CannotConnectError
end

0 comments on commit 1d78fb7

Please sign in to comment.