simple_throttle 1.0.2 → 1.0.3

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: 25cae7f3e3702407aca9ce8b20dd4a2016cdefffd9220261a0397150b10796de
4
- data.tar.gz: f460f12908747e7d8d5431a7ed13274fa6eec4980a60b95949d78e553b297fb0
3
+ metadata.gz: 88bc1f488ffad8621894918d48bbde5df0c68ef498ddaaf359d91f81914a27c5
4
+ data.tar.gz: c219a0b2a6b66e1e5427bdab8260dcfc4f0121618fd8c340a3e892f92dad1192
5
5
  SHA512:
6
- metadata.gz: 96a6efaf9ed64b918ef077296bc1b04c36ef10f8e0e08948e505bf5203b79c4673a0435dc052c750249fb5dd7de1f9b71cab1790743aee10508bef72546bf3bc
7
- data.tar.gz: 5dd505cf1da9506c505598013ab644367da24b9542687d5cf2e1f8a5cb571ad685388bd1dad8621598035d5810a615ce85baf65efc272aa6f1642fc637cf187b
6
+ metadata.gz: 9e30ae0a0a4dbfb09778fc1cfcd02d3376b020fc83d4166a2ab6066725a4c2c0e8680f38ac26c127b6b0952ed4558ff9c3e82e0301dda0dc4db9bf831cb8c383
7
+ data.tar.gz: 5cfb1b4e72a4b1014a131b50ddb028e41289b102016b54ba2a5eef4c03d2f7a5edd66b21c84924be54df1e01796d0c1c2c963a7cf8072bfc1ca7951bab983a47
data/CHANGELOG.md CHANGED
@@ -4,12 +4,17 @@ 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.3
8
+
9
+ ### Changed
10
+ - Ensure that arguments sent to Redis Lua script are cast to integers.
11
+
7
12
  ## 1.0.2
8
13
 
9
14
  ### Added
10
- - Throttle insances can now specify the Redis instance to override the global setting
11
- - Redis instance now defaults to the default redis instance: `Redis.new`
12
- - Optimize loading LUA script to Redis; now done globally instead of per throttle instance
15
+ - Throttle insances can now specify the Redis instance to override the global setting.
16
+ - Redis instance now defaults to the default redis instance: `Redis.new`.
17
+ - Optimize loading LUA script to Redis; now done globally instead of per throttle instance.
13
18
 
14
19
 
15
20
  ## 1.0.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -101,8 +101,8 @@ class SimpleThrottle
101
101
  def initialize(name, ttl:, limit:, redis: nil)
102
102
  @name = name.to_s
103
103
  @name = name.dup.freeze unless name.frozen?
104
- @limit = limit
105
- @ttl = ttl
104
+ @limit = limit.to_i
105
+ @ttl = ttl.to_f
106
106
  @redis = redis
107
107
  end
108
108
 
@@ -152,7 +152,7 @@ class SimpleThrottle
152
152
  def current_size(push)
153
153
  push_arg = (push ? 1 : 0)
154
154
  time_ms = (Time.now.to_f * 1000).round
155
- ttl_ms = ttl * 1000
155
+ ttl_ms = (ttl * 1000).ceil
156
156
  self.class.send(:execute_lua_script, redis: redis_client, keys: [redis_key], args: [limit, ttl_ms, time_ms, push_arg])
157
157
  end
158
158
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_throttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - We Heart It
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-03 00:00:00.000000000 Z
12
+ date: 2021-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis