mapbox / mapnik-pool

manage a pool of mapnik map instances
Other
20 stars 22 forks source link

Added option for synchronous map loading #7

Open davenquinn opened 8 years ago

davenquinn commented 8 years ago

In creating a module to be run in an Electron render thread, I was running into an apparent race condition with creating many pooled instances simultaneously on load (the issue seems similar to that in mapnik/mapnik#1459).

I was able to solve the issue by synchronously loading mapfiles using the map.fromStringSync method. Here, I've added this as an option (disabled by default) for mapnik-pool. I've added some tests and it appears that everything works well. There are no changes to the API except a boolean sync flag in initOptions.