Fixed key order, rate limit handling

This commit is contained in:
Anton Dyudin 2015-01-24 13:31:29 -08:00
parent cffbe9b15b
commit 759d1db9f1
3 changed files with 8 additions and 15 deletions

View File

@ -110,21 +110,14 @@
?+ p.p.sig ~|([%unknown-code p.p.sig] !!) ?+ p.p.sig ~|([%unknown-code p.p.sig] !!)
429 :: Rate-limit 429 :: Rate-limit
=. ran (~(put by ran) pax 6 lat) =. ran (~(put by ran) pax 6 lat)
=+ mez=(appl-rate:auth ~ [%resources 'statuses']~) =+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.p.sig)) poja ni:jo))
:_(+>.$ [ost %pass [%limi pax] %e %them ~ mez]~) =+ tym=?~(lim (add ~m7.s30 lat) (add ~1970.1.1 (mul ~s1 u.lim)))
~& retrying-in/`@dr`(sub tym lat)
:_(+>.$ [ost %pass pax %t %wait tym]~)
200 :: OK 200 :: OK
=+ jon=(need (poja q:(need r.p.sig))) =+ jon=(need (poja q:(need r.p.sig)))
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir))) :: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir)))
?+ pax ~|([%http-missed pax] !!) ?+ pax ~|([%http-missed pax] !!)
[%limi *]
:_ +>.$
=+ num=|=([a=cord b=$+(json (unit ,@da))] (ot:jo [a b] ~))
=. b.num (cu |=(a=@u (add ~1970.1.1 (mul a ~s1))) ni):jo
=+ paf=`path`~[%resources %statuses '/statuses/home_timeline' %reset]
~| [%no-time `wain`paf jon]
=+ tym=(need %.(jon b:(reel paf num)))
~& retrying-in/`@dr`(sub tym lat)
[ost %pass t.pax %t %wait tym]~
[%post @ ~] [%post @ ~]
=. out (~(put by out) (slav %uv i.t.pax) %| lat) =. out (~(put by out) (slav %uv i.t.pax) %| lat)
:_ +>.$ :_ +>.$

View File

@ -15,8 +15,8 @@
=. vat (flop vat) :: put into order of entry =. vat (flop vat) :: put into order of entry
?. ?=([@ @ @ @ ~] vat) ?. ?=([@ @ @ @ ~] vat)
~|([%keys-missing vat] !!) ~|([%keys-missing vat] !!)
=+ =< aut=[[utok usec] atok asec] =+ =< aut=[[ctok csec] atok asec]
`[atok=cord asec=cord utok=cord usec=cord ~]`vat `[ctok=cord csec=cord atok=cord asec=cord ~]`vat
|= ost=bone |= ost=bone
:_ ~ :_ ~
:^ ost %pass /out :^ ost %pass /out

View File

@ -1,4 +1,4 @@
AP3G1t8ki6rPzeeAqdWCTw03F
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl 2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl
jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8 jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8
AP3G1t8ki6rPzeeAqdWCTw03F
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD