diff --git a/dispatcher/frontend-ui/src/components/PipelineTable.vue b/dispatcher/frontend-ui/src/components/PipelineTable.vue index caecddd3..0b472ad9 100644 --- a/dispatcher/frontend-ui/src/components/PipelineTable.vue +++ b/dispatcher/frontend-ui/src/components/PipelineTable.vue @@ -180,12 +180,20 @@ }, async loadLastRuns() { let parent = this; + parent.last_runs_loaded = false; let schedule_names = parent.tasks.map(function (item) { return item.schedule_name; }).unique(); parent.toggleLoader("fetching last runs…"); - let requests = schedule_names.map(function (schedule_name) { - return parent.queryAPI('get', "/schedules/" + schedule_name); - }); + const chunkSize = 5; + let requests = [] + for (let i = 0; i < schedule_names.length; i += chunkSize) { + const chunk = schedule_names.slice(i, i + chunkSize); + for (let iChunk in chunk) { + requests.push(parent.queryAPI('get', "/schedules/" + chunk[iChunk])) + } + await Constants.delay(500) + } + const results = await Promise.all(requests.map(p => p.catch(e => e))); results.forEach(function (response, index) { diff --git a/dispatcher/frontend-ui/src/constants.js b/dispatcher/frontend-ui/src/constants.js index 01fe4986..d1756c1f 100644 --- a/dispatcher/frontend-ui/src/constants.js +++ b/dispatcher/frontend-ui/src/constants.js @@ -295,6 +295,10 @@ function get_timezone_details() { return {tz: dt.zoneName, offset: dt.o, offsetstr: offsetstr} } +function delay(time) { + return new Promise(resolve => setTimeout(resolve, time)); +} + var DEFAULT_CPU_SHARE = 1024; var ZIMFARM_WEBAPI = window.environ.ZIMFARM_WEBAPI || "https://api.farm.openzim.org/v1"; @@ -527,4 +531,5 @@ export default { fromSeconds: DateTime.fromSeconds, to_timestamp: to_timestamp, is_ios_firefox: isFirefoxOnIOS(), + delay: delay, };