From 9a60bc6e8a31f2bece1399a9484b18a3d1e9513f Mon Sep 17 00:00:00 2001 From: Seth Fitzsimmons Date: Sat, 5 Jul 2014 11:52:57 -0700 Subject: [PATCH] Treat missing tile data as a skip --- CHANGELOG.md | 4 ++++ lib/stream-list.js | 2 +- lib/stream-pyramid.js | 2 +- lib/stream-scanline.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d354ea..cb5a41d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Next + +* Streams treat missing tile data as skips. + ## 5.0.0 * Refactor CopyTask into read/write streams diff --git a/lib/stream-list.js b/lib/stream-list.js index 49cb7d4..4dbeefb 100644 --- a/lib/stream-list.js +++ b/lib/stream-list.js @@ -59,7 +59,7 @@ List.prototype._read = function(size) { stream.source.getTile(zxy.z, zxy.x, zxy.y, function(err, buffer) { if (err && !(/does not exist$/).test(err.message)) { stream.emit('error', err); - } else if (err || isEmpty(buffer)) { + } else if (err || !buffer || isEmpty(buffer)) { stream.stats.skipped++; stream.stats.done++; get(push); diff --git a/lib/stream-pyramid.js b/lib/stream-pyramid.js index 212eb77..902ff9f 100644 --- a/lib/stream-pyramid.js +++ b/lib/stream-pyramid.js @@ -106,7 +106,7 @@ Pyramid.prototype._read = function(size) { stream.pending--; if (err && !(/does not exist$/).test(err.message)) { stream.emit('error', err); - } else if (err || isEmpty(buffer)) { + } else if (err || !buffer || isEmpty(buffer)) { tile = new Tile(z, x, y); var sum = sumChildren(tile, stream.bboxes); stream.stats.skipped += 1 + sum; diff --git a/lib/stream-scanline.js b/lib/stream-scanline.js index cd4daca..fb5f19d 100644 --- a/lib/stream-scanline.js +++ b/lib/stream-scanline.js @@ -83,7 +83,7 @@ Scanline.prototype._read = function(size) { stream.source.getTile(z, x, y, function(err, buffer) { if (err && !(/does not exist$/).test(err.message)) { stream.emit('error', err); - } else if (err || isEmpty(buffer)) { + } else if (err || !buffer || isEmpty(buffer)) { stream.stats.skipped++; stream.stats.done++; get(push);