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.
- checksums.yaml +4 -4
- data/lib/limit/version.rb +1 -1
- data/lib/limit.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0298c1dc7c99033e8919babcecbfdc0a25fd25ff05a8ebdc53437b898bc7ee7
|
4
|
+
data.tar.gz: 63b245b43b37eaa0340298d9b4317a078868fc37862b01d414764e671ef4c84b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b959ef55df27bea377e777d83e2acaad02f166eff5ff3e6140253ab54fb5e4fd0e8d6bcf40f2ea440a20cef7099cae8f3ac468d960ce090b6fa1fbb220b4406
|
7
|
+
data.tar.gz: 9a3b26e770dda72c4096c20ed601d672faaf4ee26bff9c6cfa155c8ba8319e977c7c0477acc27417b77252b92e250e64782da291d02de5f5c97629ca8e03ad8a
|
data/lib/limit/version.rb
CHANGED
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::
|
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.
|
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-
|
11
|
+
date: 2025-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|