action-cable-redis-backport 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f6626b2fe4b7b0fd3993703be212c4f7c7f77976805827aaa11c4b1169abae9
4
- data.tar.gz: 5431c9c597ee6b58a1f532482d004cda7cd2d315e82bb0dd9b6aba784523019f
3
+ metadata.gz: 21ba9cf50ede2f8bdac15cc9771ab72c6b0af7507103dd28b7569cf08c438a88
4
+ data.tar.gz: ca4428362708d50d2b53bcdb5d8939ed5e64b40b45f26409c7d8a388420435aa
5
5
  SHA512:
6
- metadata.gz: 2e2c8f8e587c7cf9a4c34889affc53c5734a7f226398eda1bdfd54cbf6ed971ecbdb7fc78d4e9e20457ef5bfe021b9d30145ccc6a40959d80b92b7a21b2f58ce
7
- data.tar.gz: a07efe7c9d5c81a36aea1e3604a0a86fa4e7b2642f1232eab34a5fbdd4368e3f5146428a79062f16aa03afc51fa7b01833254b64d1f3c3800d9efa9ae927fd78
6
+ metadata.gz: 0176a2c994aed186fed59e2d59f42c6b0e859171a43fc13d98e3e5048c979e172686ad2c7ca5f66b5282c687a0998821fe0ab075c212651e9b79ece0999a9cea
7
+ data.tar.gz: 296efcd551ba89621e4bcb010ab5db084cd28f5d0f745caf215b4d18703c4a176e26972355794326576714b8c3d58033eb74d75f635b3850d717dc317c5ae239
data/README.md CHANGED
@@ -6,6 +6,11 @@ This gem backport Redis adapter with connection failure recovery support from Ra
6
6
 
7
7
  Works with Rails 5+.
8
8
 
9
+ <picture>
10
+ <source media="(prefers-color-scheme: dark)" srcset="/assets/fly-sponsored-landscape-dark.svg">
11
+ <img alt="Sponsored by Fly.io" src="./assets/fly-sponsored-landscape-light.svg" height="97" width="259">
12
+ </picture>
13
+
9
14
  ## Usage
10
15
 
11
16
  Install the gem:
@@ -17,12 +17,16 @@ module ActionCableRedisBackport
17
17
 
18
18
  @reconnect_attempt = 0
19
19
  @reconnect_attempts = ::ActionCable.server.config.cable&.fetch("reconnect_attempts", 1)
20
- @reconnect_attempts = Array.new(@reconnect_attempts, 0) if @reconnect_attempts.is_a?(Integer)
20
+ @reconnect_attempts = if @reconnect_attempts.is_a?(Integer)
21
+ reconnect_delay = ::ActionCable.server.config.cable["reconnect_delay"] || 0
22
+ reconnect_delay_max = ::ActionCable.server.config.cable["reconnect_delay_max"] || 0.5
23
+ @reconnect_attempts.times.map { |i| [(reconnect_delay * 2**i), reconnect_delay_max].min }
24
+ end
21
25
  end
22
26
 
23
27
  private
24
28
  if ::Redis::VERSION < "5"
25
- ConnectionError = ::Redis::ConnectionError
29
+ ConnectionError = ::Redis::BaseConnectionError
26
30
  else
27
31
  ConnectionError = RedisClient::ConnectionError
28
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action-cable-redis-backport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actioncable
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.3.11
95
+ rubygems_version: 3.4.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Backports Action Cable 7.1 Redis adapter for older versions