baza.rb 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +7 -4
- 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: fcbc7506438df13060cabc32fb5d87bb684a10a63f045d3d204788751f8e8ab5
|
4
|
+
data.tar.gz: 1e672c028f2b97bed37fedb335d9dd535a625295cbcd8592909ddf865d26b551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6300c6a5a7ee6fcd2de409901b42b3331166470348510721a3b5bbd667f69351de04cb52409b68a116cd22bea5aaa7a8c963c7167112467a3afb92796fa5aa5
|
7
|
+
data.tar.gz: fc58aab87af51e458bc6a20b91693f83f8a32507c504efcabc214fbd6e9be6c4402325bb4154326a9d8def4faed26a8ecf450251540a00cb89d1f0774f7308a5
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
@@ -644,17 +644,20 @@ class BazaRb
|
|
644
644
|
with_retries(max_tries: @retries, rescue: TimedOut, &)
|
645
645
|
end
|
646
646
|
|
647
|
-
# Execute a block with retries on 429 status codes.
|
647
|
+
# Execute a block with retries on 429 and 500 status codes.
|
648
648
|
#
|
649
649
|
# @yield The block to execute with retries
|
650
650
|
# @return [Object] The result of the block execution
|
651
651
|
def retry_if_server_busy(&)
|
652
|
+
allowed = [429, 500]
|
652
653
|
attempt = 0
|
653
654
|
loop do
|
654
655
|
ret = yield
|
655
|
-
if ret.code
|
656
|
+
if allowed.include?(ret.code) && attempt < 5
|
656
657
|
attempt += 1
|
657
|
-
|
658
|
+
seconds = 2**attempt
|
659
|
+
@loog.info("Now, will sleep for #{seconds} and try again...")
|
660
|
+
sleep(seconds)
|
658
661
|
next
|
659
662
|
end
|
660
663
|
return ret
|
@@ -691,7 +694,7 @@ class BazaRb
|
|
691
694
|
when 500
|
692
695
|
msg +=
|
693
696
|
", most probably it's an internal error on the server, " \
|
694
|
-
'please report this to https://github.com/zerocracy/baza'
|
697
|
+
'please report this to https://github.com/zerocracy/baza.rb'
|
695
698
|
when 503
|
696
699
|
msg +=
|
697
700
|
", most probably it's an internal error on the server (#{headers['X-Zerocracy-Failure'].inspect}), " \
|