Merge pull request #2330 from mapbox/node-parallel-throw

[node] throw if a render is already pending, fixes #2247
This commit is contained in:
Mike Morris
2015-09-15 13:59:48 -04:00
2 changed files with 6 additions and 6 deletions

View File

@@ -186,6 +186,10 @@ NAN_METHOD(NodeMap::Render) {
return Nan::ThrowTypeError("Style is not loaded");
}
if (nodeMap->callback) {
return Nan::ThrowError("Map is currently rendering an image");
}
auto options = ParseOptions(info[0]->ToObject());
assert(!nodeMap->callback);

View File

@@ -266,18 +266,14 @@ test('Map', function(t) {
render();
});
t.skip('throws if called in parallel', function(t) {
var completed = 0;
var remaining = 10;
var start = +new Date;
t.test('throws if called in parallel', function(t) {
var map = new mbgl.Map(options);
map.load(style);
t.throws(function() {
map.render({}, function() {});
map.render({}, function() {});
});
}, /Map is currently rendering an image/);
map.release();
t.end();