sequential segment requests (Async.js queue) instead of firing all at once,

fixes terminated requests when number of segments > maxthreads
This commit is contained in:
Norbert Renner 2014-08-20 12:34:27 +02:00
parent 7e0bda0f07
commit 9ec5985b2c
8 changed files with 2802 additions and 2 deletions

View file

@ -14,6 +14,10 @@ L.BRouter = L.Class.extend({
initialize: function (options) {
L.setOptions(this, options);
this.queue = async.queue(L.bind(function (task, callback) {
this.getRoute(task.segment, callback);
}, this), 1);
},
setOptions: function(options) {
@ -108,7 +112,7 @@ L.BRouter = L.Class.extend({
},
getRouteSegment: function(l1, l2, cb) {
return this.getRoute([l1, l2], cb);
this.queue.push({ segment: [l1, l2] }, cb);
},
uploadProfile: function(profileId, profileText, cb) {