Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

use p-queue library

Jason Kent93deba10b830
diff --git a/package-lock.json b/package-lock.json
index 7d75f2104..d5ddfa586 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18275,6 +18275,22 @@
"integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
"dev": true
},
+ "p-queue": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.1.0.tgz",
+ "integrity": "sha512-V+0vPJbhYkBqknPp0qnaz+dWcj8cNepfXZcsVIVEHPbFQXMPwrzCNIiM4FoxGtwHXtPzVCPHDvqCr1YrOJX2Gw==",
+ "requires": {
+ "eventemitter3": "^4.0.7",
+ "p-timeout": "^5.0.0"
+ },
+ "dependencies": {
+ "eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
+ }
+ }
+ },
"p-retry": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/p-retry/-/p-retry-3.0.1.tgz",
@@ -18284,6 +18300,11 @@
"retry": "^0.12.0"
}
},
+ "p-timeout": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.0.2.tgz",
+ "integrity": "sha512-sEmji9Yaq+Tw+STwsGAE56hf7gMy9p0tQfJojIAamB7WHJYJKf1qlsg9jqBWG8q9VCxKPhZaP/AcXwEoBcYQhQ=="
+ },
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
diff --git a/package.json b/package.json
index 3e839022b..4ddea75e0 100644
--- a/package.json
+++ b/package.json
@@ -192,6 +192,7 @@
"node-dir": "^0.1.17",
"ol": "6.4.x",
"ol-mapbox-style": "6.1.x",
+ "p-queue": "^7.1.0",
"proj4": "2.6.1",
"promise-queue": "2.2.5",
"prop-types": "^15.7.2",
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index 30f86111a..8b7776314 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { isEmpty as lodashIsEmpty } from 'lodash';
-import Queue from 'promise-queue';
+import PQueue from 'p-queue/dist';
import PreloadSpinner from './preload-spinner';
import util from '../../util/util';
@@ -17,7 +17,7 @@ class PlayAnimation extends React.Component {
this.state = {
isPlaying: false,
};
- this.queue = new Queue(5, Infinity);
+ this.queue = new PQueue({ concurrency: 2 });
this.preloadObject = {};
this.inQueueObject = {};
this.preloadedArray = [];
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 68fb173e7..e3a12a5c5 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -25,7 +25,7 @@ import OlLayerGroup from 'ol/layer/Group';
import * as olProj from 'ol/proj';
import { CALCULATE_RESPONSIVE_STATE } from 'redux-responsive';
import Cache from 'cachai';
-import Queue from 'promise-queue';
+import PQueue from 'p-queue/dist';
import mapDateLineBuilder from './datelinebuilder';
import mapLayerBuilder from './layerbuilder';
import MapRunningData from './runningdata';
@@ -77,7 +77,7 @@ export default function mapui(models, config, store, ui) {
duration: animationDuration,
});
const cache = new Cache(400);
- const layerQueue = new Queue(5, Infinity);
+ const layerQueue = new PQueue({ concurrency: 5 });
const { createLayer, layerKey } = mapLayerBuilder(config, cache, store);
const self = {
cache,