File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 8080 if ( answer . oldest . epoch > until ) {
8181 let tooNew = answer . oldest
8282 // first find a good starting cursor
83- while ( answer . oldest . epoch > until ) {
83+ while ( answer . oldest ?. epoch && answer . oldest . epoch > until ) {
8484 tooNew = answer . oldest
8585
8686 const rate = ( answer . newest . id - answer . oldest . id ) / ( answer . newest . epoch - answer . oldest . epoch )
8787 let cursor = Math . floor ( answer . oldest . id - rate * ( answer . oldest . epoch - until ) )
8888 answer = await getAtCursor ( cursor )
8989 }
9090
91- while ( answer . newest . epoch < until ) {
91+ while ( answer . newest ?. epoch && answer . newest . epoch < until ) {
9292 const tooOldID = answer . newest . id
9393 // we overshot, now the time window does not include `until`, backtrack via bisecting
9494 const rate = ( tooNew . id - answer . newest . id ) / ( tooNew . epoch - answer . newest . epoch )
101101 }
102102 }
103103
104- while ( answer . oldest . epoch > until ) {
104+ while ( answer . oldest ?. epoch && answer . oldest . epoch > until ) {
105105 // we overshot, maybe again, now even the oldest is too new
106106 answer = await getAtCursor ( answer . oldest . id - 1 )
107107 }
108108 }
109109
110110 const events = [ ...answer . events ]
111- while ( answer . oldest . epoch > since ) {
111+ while ( answer . oldest ?. epoch && answer . oldest . epoch > since ) {
112112 answer = await getAtCursor ( answer . oldest . id - 1 )
113113 events . push ( ...answer . events )
114114 }
You can’t perform that action at this time.
0 commit comments