reddit_bot 1.4.2 → 1.4.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
  SHA1:
3
- metadata.gz: 6b7de090239a739e1cce2756333780cd2d8ce89f
4
- data.tar.gz: 3bafbb4a30453016dc61bfd524c671453e8637e0
3
+ metadata.gz: f8ba776c1973d3a3c27aa97288b135840fc1b446
4
+ data.tar.gz: 4ba77ae39d86a2b144d8d933e455cdc2163d929d
5
5
  SHA512:
6
- metadata.gz: a37ddd7ff716714fc355679374d24893e11c0f2e0286fbdaa89ef763aafdc98ea00d7d009556bb1ed06d46ce3fea6cec2ebf6dd63c2a7569ec8c21a7813c3949
7
- data.tar.gz: 7ec222f131e2c77692d0b78f6f37304d250c1d716e21b57564f3b24334185cd4b41dbc94c62c3ea15db4843ce1982d2c699a9de8cf1ecc6647fe66018a860e06
6
+ metadata.gz: f7468a475101d393c35da187804ca9d9afd67b0ece18e20d8d35b8b66e2e362df6d34cdfba4a286dde581c60a7b0b6ff4afcf9fbd83f80a7e74d8cb2e9fa4e62
7
+ data.tar.gz: 22fb67409e5747ebe330e90a8d719e0ac3f293cb797b72ab60d4f75c8ace8ca876f142719227a22ad2c9ca8eec8900f83bb92b30b9bc9e98343274628ef09860
data/lib/reddit_bot.rb CHANGED
@@ -247,7 +247,7 @@ module RedditBot
247
247
  end
248
248
  fail remaining[0] if remaining[0].size < 4
249
249
  next if remaining[0].size > 4
250
- t = (response.to_hash["x-ratelimit-reset"][0].to_f + 1) / remaining[0].to_f + 1
250
+ t = (response.to_hash["x-ratelimit-reset"][0].to_f + 1) / [remaining[0].to_f - 10, 1].max + 1
251
251
  puts "sleeping #{t} seconds because of x-ratelimit"
252
252
  sleep t
253
253
  end
@@ -1,3 +1,3 @@
1
1
  module RedditBot
2
- VERSION = "1.4.2" # :nodoc:
2
+ VERSION = "1.4.3" # :nodoc:
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reddit_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov