Skip to content

Commit

Permalink
Revert "Improve Homeland.redis method. Follow Rails way, minimize e…
Browse files Browse the repository at this point in the history
…xternal dependencies"

This reverts commit b071e4d.
  • Loading branch information
qichunren committed Mar 10, 2024
1 parent b071e4d commit 3da8acb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/homeland.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ module Homeland
cattr_reader :boot_at

class << self

# Follow Redis offical guides make redis thread safety
# https://github.com/redis/redis-rb#connection-pooling-and-thread-safety
def redis
Rails.cache.redis.then {|redis| redis }
@redis ||= ConnectionPool::Wrapper.new do
config = Rails.application.config_for(:redis)
Redis.new(url: config["url"], db: 0)
end
end

def file_store
Expand Down

0 comments on commit 3da8acb

Please sign in to comment.