handle 429 rate-limit

This commit is contained in:
Anton Dyudin 2016-03-22 16:10:16 -07:00
parent 985f9c89d5
commit aeb02cb503

View File

@ -117,14 +117,12 @@
~& peer-again+[pax ran]
(pear | `~. pax) ::(user-from-path pax))
::
:: XX parse from stack trace?
:: ++ sigh-429 :: Rate-limit
:: |= {pax/path hit/httr}
:: =. ran (~(put by ran) pax 6 now)
:: =+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo))
:: =+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
:: ~& retrying-in+`@dr`(sub tym now)
:: :_(+>.$ [ost %wait pax tym]~)
++ sigh-recoverable-error :: Rate-limit
|= {pax/path $429 $rate-limit lim/(unit @da)}
=. ran (~(put by ran) pax 6 now)
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
~& retrying-in+`@dr`(sub tym now)
:_(+>.$ [ost %wait pax tym]~)
::
++ sigh-twit-post-post :: status acknowledged
|= {wir/wire rep/stat} ^+ done