From cb176c45831ebdea43748a42fbcf46709d78ffe5 Mon Sep 17 00:00:00 2001 From: Ben Schmidt Date: Mon, 10 Jun 2024 22:41:25 -0400 Subject: [PATCH] download more stuff in a better order --- src/Deeptable.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Deeptable.ts b/src/Deeptable.ts index f3065c0bd..d2b6bf2f7 100644 --- a/src/Deeptable.ts +++ b/src/Deeptable.ts @@ -704,7 +704,7 @@ export class Deeptable { spawnDownloads( bbox: Rectangle | undefined, max_ix: number, - queue_length = 8, + queue_length = 32, fields: string[] = ['x', 'y', 'ix'], priority: 'high' | 'low' = 'high', ): boolean { @@ -728,8 +728,9 @@ export class Deeptable { return; } if (bbox === undefined) { - // Just depth. - scores.push([1 / tile.min_ix, tile]); + // Just depth. Using the key instead of the ix in case + // the manifest isn't loaded yet. + scores.push([1 / (+tile.key.split('/')[0] + 1), tile]); } else { const distance = check_overlap(tile, bbox); if (distance > 0) { @@ -738,7 +739,7 @@ export class Deeptable { } } this.visit(scoreFileForDownload); - scores.sort((a, b) => b[0] - a[0]); + scores.sort((a, b) => a[0] - b[0]); while (scores.length > 0 && queue.size < queue_length) { const [distance, tile] = scores.pop() as [number, Tile]; if ((tile.min_ix && tile.min_ix > max_ix) || distance <= 0) {