co-limit 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/limit/version.rb +1 -1
  3. data/lib/limit.rb +12 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f54e6c9ae0b841090b1fe2eae972242c4a416eb504de4940cc807a500f7d27a
4
- data.tar.gz: ebc7e45c7c29b425a4391230173f8db3a44c288482a917f2ef8e57be75552a31
3
+ metadata.gz: d0298c1dc7c99033e8919babcecbfdc0a25fd25ff05a8ebdc53437b898bc7ee7
4
+ data.tar.gz: 63b245b43b37eaa0340298d9b4317a078868fc37862b01d414764e671ef4c84b
5
5
  SHA512:
6
- metadata.gz: 8535547535b239b227de6f78dfa0c37380e33c77f74db7c85ad91792068847b44f9074b02b3e034f9d94c8c89d517ac884ab18f111aaaca8bdeee02fc774b2ba
7
- data.tar.gz: b37ee6f384eed0728a8b4a29b3271475bbe42607c0d879471081947ec4d2c34ef7d14be28f95b305094cf2cb8c548c6aa3a5a1b77fdc5fbf0eac52711fe0ac53
6
+ metadata.gz: 6b959ef55df27bea377e777d83e2acaad02f166eff5ff3e6140253ab54fb5e4fd0e8d6bcf40f2ea440a20cef7099cae8f3ac468d960ce090b6fa1fbb220b4406
7
+ data.tar.gz: 9a3b26e770dda72c4096c20ed601d672faaf4ee26bff9c6cfa155c8ba8319e977c7c0477acc27417b77252b92e250e64782da291d02de5f5c97629ca8e03ad8a
data/lib/limit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Limit
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
data/lib/limit.rb CHANGED
@@ -54,6 +54,7 @@ module Limit
54
54
 
55
55
  # Will be using the same connection across all instance unless wanted to connect to diff instance of redis
56
56
 
57
+ #TODO: Connection creation can be lazy
57
58
  @redis = if host && port && password
58
59
  self.class.send(:create_connection, host: host, port: port, password: password)
59
60
  else
@@ -98,9 +99,19 @@ module Limit
98
99
  end
99
100
 
100
101
  def redis_pipeline(&block)
102
+ attempts ||= 0
101
103
  begin
102
104
  @redis.pipelined { |pipe| block.call(pipe) }
103
- rescue Redis::CommandError => e
105
+ rescue Redis::CannotConnectError, Redis::TimeoutError, Redis::ConnectionError => e
106
+ if attempts < 3
107
+ @logger.warn(e.message)
108
+ @redis = self.class.connection
109
+ attempts += 1
110
+ retry
111
+ else
112
+ @logger.error("Error connecting to Redis: #{e.message}")
113
+ end
114
+ rescue Redis::BaseError => e
104
115
  @logger.error(e.message)
105
116
  end
106
117
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: co-limit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CosmicOppai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-30 00:00:00.000000000 Z
11
+ date: 2025-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis