additional fixes for install script

This commit is contained in:
Albert Yi
2016-10-17 15:53:37 -07:00
parent 86af580445
commit ced7a34afa
5 changed files with 22 additions and 2 deletions

View File

@@ -98,7 +98,7 @@ module Danbooru
# List of memcached servers
def memcached_servers
%w(localhost:11211)
%w(127.0.0.1:11211)
end
# After a post receives this many comments, new comments will no longer bump the post in comment/index.

View File

@@ -2,6 +2,21 @@ unless defined?(MEMCACHE)
MEMCACHE = Dalli::Client.new(Danbooru.config.memcached_servers, :namespace => Danbooru.config.app_name.gsub(/[^A-Za-z0-9]/, "_"))
end
begin
MEMCACHE.get("x")
rescue Dalli::RingError => e
puts "-" * 40
puts "WARNING! MEMCACHE SERVER NOT FOUND! You will experience performance degradation."
puts e.to_s
puts "-- BEGIN STACKTRACE --"
e.backtrace.each do |line|
puts line
end
puts "-- END STACKTRACE --"
puts "-" * 40
MEMCACHE = MemcacheMock.new
end
if Rails.env.production?
Rails.application.configure do
config.cache_store = :dalli_store, Danbooru.config.memcached_servers