redis-client 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/redis_client/pid_cache.rb +34 -0
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e453ca140b38cff3f62e947e4168ca950117d1ff03562e5d6ed2bad0dbdd83
|
4
|
+
data.tar.gz: 8fe7edeb11051105d2505f95e6cda7360c2cf6a438b93e5bb0f775538456f28d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27596015912265226cd39b7c6e27fff214e096166121aa0e8dba0a0f81a7ba45663c0d28239e3610d57c3955ace8cfc1f428c4af8f9373b80bb196eeb89c61a8
|
7
|
+
data.tar.gz: 91b24e94e5332f4e74ca2dbb2e9adc60f7e8f9c5b698b1af5dfd5483bf836c95f6a79f39689272b742c6693ff8b6a6dd0d275e820f4a29f6d86b4dab650be6b4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RedisClient
|
4
|
+
module PIDCache
|
5
|
+
if !Process.respond_to?(:fork) # JRuby or TruffleRuby
|
6
|
+
@pid = Process.pid
|
7
|
+
singleton_class.attr_reader(:pid)
|
8
|
+
elsif Process.respond_to?(:_fork) # Ruby 3.1+
|
9
|
+
class << self
|
10
|
+
attr_reader :pid
|
11
|
+
|
12
|
+
def update!
|
13
|
+
@pid = Process.pid
|
14
|
+
end
|
15
|
+
end
|
16
|
+
update!
|
17
|
+
|
18
|
+
module CoreExt
|
19
|
+
def _fork
|
20
|
+
child_pid = super
|
21
|
+
PIDCache.update! if child_pid == 0
|
22
|
+
child_pid
|
23
|
+
end
|
24
|
+
end
|
25
|
+
Process.singleton_class.prepend(CoreExt)
|
26
|
+
else # Ruby 3.0 or older
|
27
|
+
class << self
|
28
|
+
def pid
|
29
|
+
Process.pid
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "redis_client/version"
|
4
4
|
require "redis_client/command_builder"
|
5
5
|
require "redis_client/config"
|
6
|
+
require "redis_client/pid_cache"
|
6
7
|
require "redis_client/sentinel_config"
|
7
8
|
require "redis_client/middlewares"
|
8
9
|
|
@@ -67,7 +68,7 @@ class RedisClient
|
|
67
68
|
@read_timeout = read_timeout
|
68
69
|
@write_timeout = write_timeout
|
69
70
|
@command_builder = config.command_builder
|
70
|
-
@pid =
|
71
|
+
@pid = PIDCache.pid
|
71
72
|
end
|
72
73
|
|
73
74
|
def timeout=(timeout)
|
@@ -609,7 +610,7 @@ class RedisClient
|
|
609
610
|
end
|
610
611
|
|
611
612
|
def ensure_connected(retryable: true)
|
612
|
-
close if !config.inherit_socket && @pid !=
|
613
|
+
close if !config.inherit_socket && @pid != PIDCache.pid
|
613
614
|
|
614
615
|
if @disable_reconnection
|
615
616
|
if block_given?
|
@@ -658,7 +659,7 @@ class RedisClient
|
|
658
659
|
end
|
659
660
|
|
660
661
|
def connect
|
661
|
-
@pid =
|
662
|
+
@pid = PIDCache.pid
|
662
663
|
|
663
664
|
connection = @middlewares.connect(config) do
|
664
665
|
config.driver.new(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/redis_client/connection_mixin.rb
|
46
46
|
- lib/redis_client/decorator.rb
|
47
47
|
- lib/redis_client/middlewares.rb
|
48
|
+
- lib/redis_client/pid_cache.rb
|
48
49
|
- lib/redis_client/pooled.rb
|
49
50
|
- lib/redis_client/ruby_connection.rb
|
50
51
|
- lib/redis_client/ruby_connection/buffered_io.rb
|