From 6395408e25e1684f15675c0a254abae350bb8f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 17 Mar 2023 14:01:30 +0000 Subject: [PATCH] feat: Add optional delay after each QVF file upload to Sense Implements #198 --- src/ctrl-q.js | 10 ++++++++++ src/lib/app/class_allapps.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ctrl-q.js b/src/ctrl-q.js index c5320b4..5d46881 100644 --- a/src/ctrl-q.js +++ b/src/ctrl-q.js @@ -530,6 +530,11 @@ const program = new Command(); 'import at most x number of tasks from the source file. Defaults to 0 = no limit', 0 ) + .requiredOption( + '--sleep-app-upload ', + 'Wait this long before continuing after each app has been uploaded to Sense. Defaults to 1000 = 1 second', + 1000 + ) .option('--import-app', 'import Sense app QVFs from specified directory') .option('--import-app-sheet-name ', 'name of Excel sheet where app definitions are found') @@ -570,6 +575,11 @@ const program = new Command(); .requiredOption('--sheet-name ', 'name of Excel sheet where app info is found') .requiredOption('--limit-import-count ', 'import at most x number of apps. Defaults to 0 = no limit', 0) + .requiredOption( + '--sleep-app-upload ', + 'Wait this long before continuing after each app has been uploaded to Sense. Defaults to 1000 = 1 second', + 1000 + ) .option('--dry-run', 'do a dry run, i.e. do not import any apps - just show what would be done'); diff --git a/src/lib/app/class_allapps.js b/src/lib/app/class_allapps.js index 1d81109..da41ce1 100644 --- a/src/lib/app/class_allapps.js +++ b/src/lib/app/class_allapps.js @@ -297,7 +297,8 @@ class QlikSenseApps { // Upload QVF const result = await myAxiosInstance.request(axiosConfig); - // await sleep(1000); + logger.verbose(`App upload done, sleeping for ${this.options.sleepAppUpload} milliseconds`); + await sleep(this.options.sleepAppUpload); if (result.status === 201) { logger.debug(`Import app from QVF file success, result from API:\n${JSON.stringify(result.data, null, 2)}`);