Run clearCaches synchronously to prevent _commit from erroring out when called prior to startWriting completing.
This commit is contained in:
@@ -398,6 +398,7 @@ MBTiles.prototype.startWriting = function(callback) {
|
||||
if (!this.open) return callback(new Error('MBTiles not yet loaded'));
|
||||
|
||||
var mbtiles = this;
|
||||
mbtiles._clearCaches();
|
||||
Step(function() {
|
||||
mbtiles._setup(this);
|
||||
}, function(err) {
|
||||
@@ -406,7 +407,6 @@ MBTiles.prototype.startWriting = function(callback) {
|
||||
// See http://www.sqlite3.org/pragma.html#pragma_synchronous
|
||||
if (!mbtiles._isWritable) {
|
||||
mbtiles._isWritable = 1;
|
||||
mbtiles._clearCaches();
|
||||
mbtiles._db.run('PRAGMA synchronous=OFF', this);
|
||||
} else {
|
||||
mbtiles._isWritable++;
|
||||
|
||||
Reference in New Issue
Block a user