simple_throttle 1.0.6 → 1.0.7

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: 8e18797fda6fc1d6b7c7fec9630876cca2ddffce4c716767598d0491d763d86e
4
- data.tar.gz: f20bb9caa31be9ec0b185be99ead23d56a644e8f73662da97efa3ebd0bcac4a0
3
+ metadata.gz: 4bf38f023dce00a87b27e9b2f39d0519a8dbb4abd90b549697be21ed6792bd7f
4
+ data.tar.gz: 35023bd729899add113084518e63f8ee6975bf71c7a5b12fc0ceb64924ccd207
5
5
  SHA512:
6
- metadata.gz: 4950eeea8f2419d800921816c7de0a4b3d120fd37462881c07bc2bb8720046b27a6ecbbc6709e314191bae5f225c3ae794cb9af2f34b2358490a4888f429ccce
7
- data.tar.gz: f8c2e359ddd7b9b429ac2863dbc63d3614a00f3f8f15b85d0f509aae89140e0ac2d880945fafa737330fccff95559fa8a2c1d6f30f7513da28945ec0a9424bdd
6
+ metadata.gz: dfab9a31ebc150ceb5f6b8833efc670357eefa790e60b33156607f7d72155566c300c454fc58368cae15936b8152f2c47e5ed83875ca3b8e0f58f9219d03d5e1
7
+ data.tar.gz: 4a3bd5605206b8b1e93bcc527c7d3f2dbf22590f23e390c4cb5c75ba7ac3cbe2fef885adffb62006fed54f310eea5804e10c6f319c81c45c8832971d36818718
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ 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.7
8
+
9
+ ## Fixed
10
+ - Fixed peek method to return the correct value rather than the raw value from Redis.
11
+
12
+ ### Changed
13
+ - Updated repository location and gem owners
14
+
7
15
  ## 1.0.6
8
16
 
9
17
  ### Added
data/MIT_LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 WHI, Inc.
1
+ Copyright (c) 2016 Brian Durand
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![Maintainability](https://api.codeclimate.com/v1/badges/0535eef45908cc64b740/maintainability)](https://codeclimate.com/github/weheartit/simple_throttle/maintainability)
2
1
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
3
2
 
4
3
  This gem provides a very simple throttling mechanism backed by Redis for limiting access to a resource. The throttle can be thought of as a limit on the number of calls in a set time frame (i.e. 100 calls per hour).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
@@ -157,7 +157,9 @@ class SimpleThrottle
157
157
  #
158
158
  # @return [Integer]
159
159
  def peek
160
- current_size(false)
160
+ timestamps = redis_client.lrange(redis_key, 0, -1).collect(&:to_i)
161
+ min_timestamp = ((Time.now.to_f - ttl) * 1000).ceil
162
+ timestamps.count { |t| t > min_timestamp }
161
163
  end
162
164
 
163
165
  # Returns when the next resource call should be allowed. Note that this doesn't guarantee that
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "simple_throttle"
3
3
  spec.version = File.read(File.expand_path("../VERSION", __FILE__)).strip
4
- spec.authors = ["We Heart It", "Brian Durand"]
5
- spec.email = ["dev@weheartit.com", "bbdurand@gmail.com"]
4
+ spec.authors = ["Brian Durand"]
5
+ spec.email = ["bbdurand@gmail.com"]
6
6
 
7
7
  spec.summary = "Simple redis backed throttling mechanism to limit access to a resource"
8
- spec.homepage = "https://github.com/weheartit/simple_throttle"
8
+ spec.homepage = "https://github.com/bdurand/simple_throttle"
9
9
  spec.license = "MIT"
10
10
 
11
11
  # Specify which files should be added to the gem when it is released.
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_throttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
- - We Heart It
8
7
  - Brian Durand
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redis
@@ -41,7 +40,6 @@ dependencies:
41
40
  version: '0'
42
41
  description:
43
42
  email:
44
- - dev@weheartit.com
45
43
  - bbdurand@gmail.com
46
44
  executables: []
47
45
  extensions: []
@@ -53,7 +51,7 @@ files:
53
51
  - VERSION
54
52
  - lib/simple_throttle.rb
55
53
  - simple_throttle.gemspec
56
- homepage: https://github.com/weheartit/simple_throttle
54
+ homepage: https://github.com/bdurand/simple_throttle
57
55
  licenses:
58
56
  - MIT
59
57
  metadata: {}