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:
parent
7e0bda0f07
commit
9ec5985b2c
8 changed files with 2802 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -3,5 +3,9 @@ bower_components/leaflet-routing/examples/
|
||||||
bower_components/Leaflet.Elevation/*
|
bower_components/Leaflet.Elevation/*
|
||||||
!bower_components/Leaflet.Elevation/dist/
|
!bower_components/Leaflet.Elevation/dist/
|
||||||
!bower_components/Leaflet.Elevation/src/
|
!bower_components/Leaflet.Elevation/src/
|
||||||
|
bower_components/async/*
|
||||||
|
!bower_components/async/lib/
|
||||||
|
!bower_components/async/README.md
|
||||||
|
!bower_components/async/LICENSE
|
||||||
nbproject/
|
nbproject/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
||||||
|
|
@ -59,3 +59,5 @@ Copyright (c) 2013 Stefano Cudini; [MIT License](https://github.com/stefanocudin
|
||||||
Copyright (c) 2011-2012, Pavel Shramov; [2-clause BSD License](https://github.com/shramov/leaflet-plugins/blob/master/LICENSE)
|
Copyright (c) 2011-2012, Pavel Shramov; [2-clause BSD License](https://github.com/shramov/leaflet-plugins/blob/master/LICENSE)
|
||||||
* [normalize.css](https://github.com/necolas/normalize.css)
|
* [normalize.css](https://github.com/necolas/normalize.css)
|
||||||
Copyright (c) Nicolas Gallagher and Jonathan Neal; [MIT License](https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
Copyright (c) Nicolas Gallagher and Jonathan Neal; [MIT License](https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||||
|
* [Async.js](https://github.com/caolan/async)
|
||||||
|
Copyright (c) 2010-2014 Caolan McMahon; [MIT License](https://github.com/caolan/async/blob/master/LICENSE)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
"leaflet-search": "*",
|
"leaflet-search": "*",
|
||||||
"leaflet-plugins": "*",
|
"leaflet-plugins": "*",
|
||||||
"leaflet-routing": "Turistforeningen/leaflet-routing#gh-pages",
|
"leaflet-routing": "Turistforeningen/leaflet-routing#gh-pages",
|
||||||
"Leaflet.Elevation": "MrMufflon/Leaflet.Elevation#master"
|
"Leaflet.Elevation": "MrMufflon/Leaflet.Elevation#master",
|
||||||
|
"async": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
bower_components/async/LICENSE
vendored
Normal file
19
bower_components/async/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2010-2014 Caolan McMahon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
1646
bower_components/async/README.md
vendored
Normal file
1646
bower_components/async/README.md
vendored
Normal file
File diff suppressed because it is too large
Load diff
1123
bower_components/async/lib/async.js
vendored
Executable file
1123
bower_components/async/lib/async.js
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -79,6 +79,7 @@
|
||||||
<!--<script src="http://d3js.org/d3.v3.min.js"></script>-->
|
<!--<script src="http://d3js.org/d3.v3.min.js"></script>-->
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js"></script>
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js"></script>
|
||||||
<script src="bower_components/Leaflet.Elevation/src/L.Control.Elevation.js"></script>
|
<script src="bower_components/Leaflet.Elevation/src/L.Control.Elevation.js"></script>
|
||||||
|
<script src="bower_components/async/lib/async.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// global package prefix for BRouter web application
|
// global package prefix for BRouter web application
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@ L.BRouter = L.Class.extend({
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
L.setOptions(this, options);
|
L.setOptions(this, options);
|
||||||
|
|
||||||
|
this.queue = async.queue(L.bind(function (task, callback) {
|
||||||
|
this.getRoute(task.segment, callback);
|
||||||
|
}, this), 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
setOptions: function(options) {
|
setOptions: function(options) {
|
||||||
|
|
@ -108,7 +112,7 @@ L.BRouter = L.Class.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getRouteSegment: function(l1, l2, cb) {
|
getRouteSegment: function(l1, l2, cb) {
|
||||||
return this.getRoute([l1, l2], cb);
|
this.queue.push({ segment: [l1, l2] }, cb);
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadProfile: function(profileId, profileText, cb) {
|
uploadProfile: function(profileId, profileText, cb) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue