mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
eth-watcher: zoom per 100k blocks
This avoids extremely large responses for long zooms, which could cause trouble during parsing.
This commit is contained in:
parent
bc08e8a09f
commit
69df84b252
@ -79,9 +79,16 @@
|
||||
=/ m (strand:strandio ,watchpup)
|
||||
^- form:m
|
||||
=/ zoom-margin=number:block 100
|
||||
=/ zoom-step=number:block 100.000
|
||||
?: (lth latest-number (add number.pup zoom-margin))
|
||||
(pure:m pup)
|
||||
=/ to-number=number:block (sub latest-number zoom-margin)
|
||||
=/ up-to-number=number:block (sub latest-number zoom-margin)
|
||||
|-
|
||||
=* loop $
|
||||
?: (gth number.pup up-to-number)
|
||||
(pure:m pup(blocks ~))
|
||||
=/ to-number=number:block
|
||||
(min up-to-number (add number.pup zoom-step))
|
||||
;< =loglist bind:m :: oldest first
|
||||
%: get-logs-by-range:ethio
|
||||
url.pup
|
||||
@ -92,7 +99,5 @@
|
||||
==
|
||||
=? pending-logs.pup ?=(^ loglist)
|
||||
(~(put by pending-logs.pup) to-number loglist)
|
||||
=. number.pup +(to-number)
|
||||
=. blocks.pup ~
|
||||
(pure:m pup)
|
||||
loop(number.pup +(to-number))
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user