diff --git a/lib/mbtiles.js b/lib/mbtiles.js index 66e5fd5..7e7f069 100644 --- a/lib/mbtiles.js +++ b/lib/mbtiles.js @@ -560,7 +560,7 @@ MBTiles.prototype.putTile = function(z, x, y, data, callback) { this._mapCache[coords].tile_id = id; // Only commit when we can insert at least 100 rows. - if (++this._pending < 100) return this._commit(callback); + if (++this._pending >= 100) return this._commit(callback); else return callback(null); }; @@ -599,7 +599,7 @@ MBTiles.prototype.putGrid = function(z, x, y, data, callback) { this._mapCache[coords].grid_id = id; // Only commit when we can insert at least 100 rows. - if (++this._pending < 100) return this._commit(callback); + if (++this._pending >= 100) return this._commit(callback); else return callback(null); };