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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd25dd96b13df27a165952bee5a5ff4fd6731c164c88aaa586e2c990a47650d3
4
- data.tar.gz: 4298862682b63ef05bebf1e70abb62bf1dad5e7c3a23835e4c9ad94ed38c8cd5
3
+ metadata.gz: 30c315dd33f7e175c0e74b4dfd8344e889d7e856c96c786b87ebac29d07fcc3a
4
+ data.tar.gz: acfb600e437eb125b9bf279dd95315ce7fa40612f836f887003b360ae2aacceb
5
5
  SHA512:
6
- metadata.gz: 52eda43dd29e5c4ceadb806c0a132abeb30737365aea897a33815e7aa40ca518ea97ed4506c3b612e4729f08e9e3534877dd9f3d6890925cdb8bf7afdc4a5e70
7
- data.tar.gz: 839f5e758fe348fa974dd3b8e3b2d37827002ab39db178058095344ed90c94b25aeb6a477d93ac042a9d291bf3afd8bbf13672b60a91233fa09cb13861a94bf1
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.4
1
+ 1.0.5
@@ -95,12 +95,16 @@ class SimpleThrottle
95
95
  private
96
96
 
97
97
  def execute_lua_script(redis:, keys:, args:)
98
- @script_sha_1 ||= redis.script(:load, LUA_SCRIPT)
98
+ client = redis
99
+ @script_sha_1 ||= client.script(:load, LUA_SCRIPT)
100
+ attempts = 0
101
+
99
102
  begin
100
- redis.evalsha(@script_sha_1, Array(keys), Array(args))
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 = redis.script(:load, LUA_SCRIPT)
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
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-02-10 00:00:00.000000000 Z
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.0.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: []