mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: s/\$redis/Discourse\.redis (#8431)
This commit also adds a rubocop rule to prevent global variables.
This commit is contained in:
@@ -243,7 +243,7 @@ module Discourse
|
||||
require 'logster/redis_store'
|
||||
# Use redis for our cache
|
||||
config.cache_store = DiscourseRedis.new_redis_store
|
||||
$redis = DiscourseRedis.new
|
||||
$redis = DiscourseRedis.new # rubocop:disable Style/GlobalVars
|
||||
Logster.store = Logster::RedisStore.new(DiscourseRedis.new)
|
||||
|
||||
# we configure rack cache on demand in an initializer
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
||||
puts "Flushing redis (development mode)"
|
||||
$redis.flushall
|
||||
Discourse.redis.flushall
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ end
|
||||
|
||||
MiniScheduler.configure do |config|
|
||||
|
||||
config.redis = $redis
|
||||
config.redis = Discourse.redis
|
||||
|
||||
config.job_exception_handler do |ex, context|
|
||||
Discourse.handle_job_exception(ex, context)
|
||||
|
||||
@@ -29,7 +29,7 @@ Thread.new do
|
||||
|
||||
if old_time != time
|
||||
Rails.logger.info "attempting to reload #{$$} #{$PROGRAM_NAME} in #{wait_seconds} seconds"
|
||||
$shutdown = true
|
||||
$shutdown = true # rubocop:disable Style/GlobalVars
|
||||
sleep wait_seconds
|
||||
Rails.logger.info "restarting #{$$}"
|
||||
Process.kill("USR2", $$)
|
||||
|
||||
@@ -155,7 +155,7 @@ before_fork do |server, worker|
|
||||
sleep 10
|
||||
force_kill_rogue_sidekiq
|
||||
end
|
||||
$redis._client.disconnect
|
||||
Discourse.redis._client.disconnect
|
||||
end
|
||||
end
|
||||
|
||||
@@ -170,7 +170,7 @@ before_fork do |server, worker|
|
||||
|
||||
end
|
||||
|
||||
$redis._client.disconnect
|
||||
Discourse.redis._client.disconnect
|
||||
|
||||
# Throttle the master from forking too quickly by sleeping. Due
|
||||
# to the implementation of standard Unix signal handlers, this
|
||||
|
||||
Reference in New Issue
Block a user