Commit 40936e6
committed
fix(cloud-import): stop windowed page fetch on a short window, not the tree's max index
_fetch_cloud_pages bounded its loop by the tree's max page index
(_max_page_index). When the cloud tree under-reports the page count — a real
case (e.g. a paper whose tree stops a couple pages short of the references) — the
loop exited before fetching a later window and silently DROPPED pages. At the
exact 1000 boundary this was an off-by-one (a 1001-page doc whose tree maxes at
1000 lost page 1001); more generally any >1000-page doc with an under-reporting
tree was truncated.
Drop the max-index bound: request fixed 1000-page windows and stop as soon as a
window comes back SHORT (PageIndex page numbers are sequential, so a short window
means we've passed the last page). The common ≤1000-page doc stays a single
request, a larger doc fetches every page, and an under-reported tree no longer
truncates. Remove the now-unused _max_page_index. Tests updated + a
full-window-triggers-next-fetch regression.1 parent 47b4616 commit 40936e6
2 files changed
Lines changed: 42 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 221 | + | |
244 | 222 | | |
245 | 223 | | |
246 | 224 | | |
247 | 225 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
254 | 235 | | |
255 | 236 | | |
256 | | - | |
257 | 237 | | |
258 | | - | |
| 238 | + | |
259 | 239 | | |
260 | 240 | | |
261 | 241 | | |
262 | | - | |
263 | | - | |
264 | 242 | | |
| 243 | + | |
| 244 | + | |
265 | 245 | | |
266 | 246 | | |
267 | 247 | | |
| |||
303 | 283 | | |
304 | 284 | | |
305 | 285 | | |
306 | | - | |
| 286 | + | |
307 | 287 | | |
308 | 288 | | |
309 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
| 365 | + | |
365 | 366 | | |
366 | 367 | | |
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
371 | 394 | | |
372 | 395 | | |
373 | 396 | | |
| |||
0 commit comments