FIX: update Redis gem to version 4.1.3
I run our benchmark on commit with hiredis and redis-4.1.3 Results: type | hidredis | redis 4.1.3 | percent --- | --- | --- | --- Categories-50 | 49 | 50 | 102.04% Categories-75 | 51 | 51 | 100.00% Categories-90 | 63 | 64 | 101.59% Categories-99 | 86 | 85 | 98.84% Home-50 | 55 | 55 | 100.00% Home-75 | 56 | 57 | 101.79% Home-90 | 68 | 69 | 101.47% Home-99 | 102 | 104 | 101.96% Topic-50 | 36 | 37 | 102.78% Topic-75 | 37 | 37 | 100.00% Topic-90 | 47 | 48 | 102.13% Topic-99 | 60 | 61 | 101.67% Categories-admin-50 | 124 | 117 | 94.35% Categories-admin-75 | 130 | 129 | 99.23% Categories-admin-90 | 147 | 143 | 97.28% Categories-admin-99 | 204 | 199 | 97.55% Home-admin-50 | 146 | 148 | 101.37% Home-admin-75 | 150 | 152 | 101.33% Home-admin-90 | 169 | 168 | 99.41% Home-admin-99 | 232 | 223 | 96.12% Topic-admin-50 | 60 | 61 | 101.67% Topic-admin-75 | 64 | 63 | 98.44% Topic-admin-90 | 76 | 73 | 96.05% Topic-admin-99 | 124 | 94 | 75.81% Load rails | 2412 | 2360 | 97.84% rss | 290204 | 295828 | 101.94% pss | 277948 | 283624 | 102.04% Redis gem is manipulating Redis config https://github.com/redis/redis-rb/blob/master/lib/redis/client.rb#L95 therefore we cannot pass the frozen config object. Pass of the copy of the object is protecting original config
This commit is contained in:
parent
054fbd7846
commit
858cf5836c
9
Gemfile
9
Gemfile
|
@ -36,14 +36,7 @@ gem 'mail', require: false
|
||||||
gem 'mini_mime'
|
gem 'mini_mime'
|
||||||
gem 'mini_suffix'
|
gem 'mini_suffix'
|
||||||
|
|
||||||
# holding off redis upgrade temporarily as it is having issues with our current
|
gem 'redis', '4.1.3'
|
||||||
# freedom patch, we will follow this up.
|
|
||||||
#
|
|
||||||
# FrozenError: can't modify frozen Hash
|
|
||||||
# /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.1.0/lib/redis/client.rb:93:in `delete'
|
|
||||||
# /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.1.0/lib/redis/client.rb:93:in `initialize'
|
|
||||||
# /var/www/discourse/lib/freedom_patches/redis.rb:7:in `initialize'
|
|
||||||
gem 'redis', '4.0.1'
|
|
||||||
gem 'redis-namespace'
|
gem 'redis-namespace'
|
||||||
|
|
||||||
gem 'active_model_serializers', '~> 0.8.3'
|
gem 'active_model_serializers', '~> 0.8.3'
|
||||||
|
|
|
@ -182,7 +182,7 @@ GEM
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
maxminddb (0.1.22)
|
maxminddb (0.1.22)
|
||||||
memory_profiler (0.9.13)
|
memory_profiler (0.9.13)
|
||||||
message_bus (2.2.2)
|
message_bus (2.2.3)
|
||||||
rack (>= 1.1.3)
|
rack (>= 1.1.3)
|
||||||
metaclass (0.0.4)
|
metaclass (0.0.4)
|
||||||
method_source (0.9.2)
|
method_source (0.9.2)
|
||||||
|
@ -309,7 +309,7 @@ GEM
|
||||||
msgpack (>= 0.4.3)
|
msgpack (>= 0.4.3)
|
||||||
optimist (>= 3.0.0)
|
optimist (>= 3.0.0)
|
||||||
rchardet (1.8.0)
|
rchardet (1.8.0)
|
||||||
redis (4.0.1)
|
redis (4.1.3)
|
||||||
redis-namespace (1.6.0)
|
redis-namespace (1.6.0)
|
||||||
redis (>= 3.0.4)
|
redis (>= 3.0.4)
|
||||||
request_store (1.4.1)
|
request_store (1.4.1)
|
||||||
|
@ -516,7 +516,7 @@ DEPENDENCIES
|
||||||
rb-inotify (~> 0.9)
|
rb-inotify (~> 0.9)
|
||||||
rbtrace
|
rbtrace
|
||||||
rchardet
|
rchardet
|
||||||
redis (= 4.0.1)
|
redis (= 4.1.3)
|
||||||
redis-namespace
|
redis-namespace
|
||||||
rinku
|
rinku
|
||||||
rotp
|
rotp
|
||||||
|
|
|
@ -241,7 +241,6 @@ module Discourse
|
||||||
|
|
||||||
require 'discourse_redis'
|
require 'discourse_redis'
|
||||||
require 'logster/redis_store'
|
require 'logster/redis_store'
|
||||||
require 'freedom_patches/redis'
|
|
||||||
# Use redis for our cache
|
# Use redis for our cache
|
||||||
config.cache_store = DiscourseRedis.new_redis_store
|
config.cache_store = DiscourseRedis.new_redis_store
|
||||||
$redis = DiscourseRedis.new
|
$redis = DiscourseRedis.new
|
||||||
|
|
|
@ -155,7 +155,7 @@ class DiscourseRedis
|
||||||
|
|
||||||
def initialize(config = nil, namespace: true)
|
def initialize(config = nil, namespace: true)
|
||||||
@config = config || DiscourseRedis.config
|
@config = config || DiscourseRedis.config
|
||||||
@redis = DiscourseRedis.raw_connection(@config)
|
@redis = DiscourseRedis.raw_connection(@config.dup)
|
||||||
@namespace = namespace
|
@namespace = namespace
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# https://github.com/redis/redis-rb/pull/591
|
|
||||||
class Redis
|
|
||||||
class Client
|
|
||||||
alias_method :old_initialize, :initialize
|
|
||||||
|
|
||||||
def initialize(options = {})
|
|
||||||
old_initialize(options)
|
|
||||||
|
|
||||||
if options.include?(:connector) && options[:connector].is_a?(Class)
|
|
||||||
@connector = options[:connector].new(@options)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue