simple_throttle 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/VERSION +1 -1
- data/lib/simple_throttle.rb +8 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30c315dd33f7e175c0e74b4dfd8344e889d7e856c96c786b87ebac29d07fcc3a
|
4
|
+
data.tar.gz: acfb600e437eb125b9bf279dd95315ce7fa40612f836f887003b360ae2aacceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89d1b64043ee7f6460be93bb12ac50728e31ede360bcaa68191cb84087d50fe7db4386d8d24eba380c37a9426df78cb26c0685da75d7f6610e244e332be2821c
|
7
|
+
data.tar.gz: 47598bdce624ab1effbefbfc36d8860f3e017a7ecb2213cdd46d8c67e681583df62bdaf1270f77f6d4e83a88de0c0222c92c3a141fb9bfc3340cbee3bf0914a3
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 1.0.5
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Make loading lua script play better with Redis clusters.
|
11
|
+
- Handle failures loading lua script on Redis server to prevent infinite loop.
|
12
|
+
|
7
13
|
## 1.0.4
|
14
|
+
|
15
|
+
### Fixed
|
8
16
|
- Fix wait_time method to match the documentation from [bc-swoop](https://github.com/bc-swoop)
|
9
17
|
|
10
18
|
## 1.0.3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/lib/simple_throttle.rb
CHANGED
@@ -95,12 +95,16 @@ class SimpleThrottle
|
|
95
95
|
private
|
96
96
|
|
97
97
|
def execute_lua_script(redis:, keys:, args:)
|
98
|
-
|
98
|
+
client = redis
|
99
|
+
@script_sha_1 ||= client.script(:load, LUA_SCRIPT)
|
100
|
+
attempts = 0
|
101
|
+
|
99
102
|
begin
|
100
|
-
|
103
|
+
client.evalsha(@script_sha_1, Array(keys), Array(args))
|
101
104
|
rescue Redis::CommandError => e
|
102
|
-
if e.message.include?("NOSCRIPT")
|
103
|
-
@script_sha_1 =
|
105
|
+
if e.message.include?("NOSCRIPT") && attempts < 2
|
106
|
+
@script_sha_1 = client.script(:load, LUA_SCRIPT)
|
107
|
+
attempts += 1
|
104
108
|
retry
|
105
109
|
else
|
106
110
|
raise e
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_throttle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- We Heart It
|
8
8
|
- Brian Durand
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
description:
|
42
|
+
description:
|
43
43
|
email:
|
44
44
|
- dev@weheartit.com
|
45
45
|
- bbdurand@gmail.com
|
@@ -57,7 +57,7 @@ homepage: https://github.com/weheartit/simple_throttle
|
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|
60
|
-
post_install_message:
|
60
|
+
post_install_message:
|
61
61
|
rdoc_options: []
|
62
62
|
require_paths:
|
63
63
|
- lib
|
@@ -72,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
76
|
-
signing_key:
|
75
|
+
rubygems_version: 3.2.22
|
76
|
+
signing_key:
|
77
77
|
specification_version: 4
|
78
78
|
summary: Simple redis backed throttling mechanism to limit access to a resource
|
79
79
|
test_files: []
|