MazeMap/Leaflet.TileLayer.PouchDBCached

Using this plugin on a page with mulitple maps generates Document update conflicts

hrishiballal opened this issue · 1 comments

When using this plugin on a page with more than one map (both maps have same bounds and tiles), on initial sync, it generates a lot of document update conflicts. This is because it is trying to put tiles from two sources at the same time (I think).

To get around it I use the pouchdb.upsert plugin and change the put code to following:

        this._db.putIfNotExists(tileUrl, doc).then(function(res) {
            // success, res is {rev: '1-xxx', updated: true}
        }).catch(function(err) {
            // error
        });

I am not sure if this sort of thing should be in the core library but wanted to raise this.

albfan commented

probably the put code modified link is not valid anymore.

Any chance to upload here at least the diff to test locally?