rubyhexagon 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubyhexagon.rb +1 -1
- data/lib/rubyhexagon/helper/api.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1be6d059e334103bb28e5cbff3c4978cb0cdd202e7f5bb095a189efc8af300b0
|
4
|
+
data.tar.gz: b928803e414e4a98922ccd5326f20db0daaaa39c23f8223669259ad91a72df1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14f25709d60914cc9c7a63bfabc1d4e7fb4deff7aa856f51415f56605423b5d45a75f23130adead64174924a5e273b8747bbb7d6df8778d72be3340b1a5cd42a
|
7
|
+
data.tar.gz: 7f15aaf02b37d6481ae8447635687caf018132f3b3b06a064438208fb7e40048fa40bd8df7c906ceccebfd550bdef52abccd5619bf9449ec3a6efece3e171192
|
data/lib/rubyhexagon.rb
CHANGED
@@ -84,10 +84,12 @@ module Rubyhexagon
|
|
84
84
|
@lock_file.truncate(0)
|
85
85
|
@lock_file.print $PROCESS_ID
|
86
86
|
begin
|
87
|
+
s = Time.now
|
87
88
|
data = yield
|
88
89
|
# There is a hard limit of 2 requests per second, but to be nice we wait
|
89
90
|
# a whole second between requests.
|
90
|
-
|
91
|
+
w = 1 - (Time.now - s)
|
92
|
+
sleep w if w.positive?
|
91
93
|
ensure
|
92
94
|
@lock_file.flock(File::LOCK_UN)
|
93
95
|
end
|