Skip to content

Commit

Permalink
Merge pull request #1056 from Accenture/feature/162-show-execution-ti…
Browse files Browse the repository at this point in the history
…me-for-retrieve-and-deploy

Feature/162 show execution time for retrieve and deploy
  • Loading branch information
JoernBerkefeld authored Jul 26, 2023
2 parents 6ff3836 + 3af63d0 commit 435ee9d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class Mcdev {
* @returns {Promise.<object>} -
*/
static async retrieve(businessUnit, selectedTypesArr, keys, changelogOnly) {
console.time('Time'); // eslint-disable-line no-console
Util.startLogger();
Util.logger.info('mcdev:: Retrieve');
const properties = await config.getProperties();
Expand Down Expand Up @@ -193,9 +194,14 @@ class Mcdev {
Util.startLogger(true);
}
counter_credTotal += counter_credBu;
Util.logger.info(`:: ${counter_credBu} BUs for ${cred}\n`);
Util.logger.info(`:: ${counter_credBu} BUs of ${cred}\n`);
}
Util.logger.info(`:: ${counter_credTotal} BUs in total\n`);
const credentialCount = Object.keys(properties.credentials).length;
Util.logger.info(
`:: Done for ${counter_credTotal} BUs of ${credentialCount} credential${
credentialCount === 1 ? '' : 's'
} in total\n`
);
} else {
let [cred, bu] = businessUnit ? businessUnit.split('/') : [null, null];
// to allow all-BU via user selection we need to run this here already
Expand Down Expand Up @@ -231,7 +237,7 @@ class Mcdev {
counter_credBu++;
Util.startLogger(true);
}
Util.logger.info(`:: ${counter_credBu} BUs for ${cred}\n`);
Util.logger.info(`:: Done for ${counter_credBu} BUs of ${cred}\n`);
} else {
// retrieve a single BU; return
const retrieveChangelog = await this.#retrieveBU(
Expand All @@ -242,6 +248,7 @@ class Mcdev {
changelogOnly
);
if (changelogOnly) {
console.timeEnd('Time'); // eslint-disable-line no-console
return retrieveChangelog;
} else {
resultsObj[`${cred}/${bu}`] = retrieveChangelog;
Expand All @@ -262,6 +269,7 @@ class Mcdev {
resultsObj[credBu][type] = resultsObj[credBu][type][0];
}
}
console.timeEnd('Time'); // eslint-disable-line no-console

return resultsObj;
}
Expand Down Expand Up @@ -385,8 +393,11 @@ class Mcdev {
* @returns {Promise.<Object.<string,TYPE.MultiMetadataTypeMap>>} deployed metadata per BU (first key: bu name, second key: metadata type)
*/
static async deploy(businessUnit, selectedTypesArr, keyArr) {
console.time('Time'); // eslint-disable-line no-console
Util.startLogger();
return Deployer.deploy(businessUnit, selectedTypesArr, keyArr);
const deployResult = await Deployer.deploy(businessUnit, selectedTypesArr, keyArr);
console.timeEnd('Time'); // eslint-disable-line no-console
return deployResult;
}

/**
Expand Down

0 comments on commit 435ee9d

Please sign in to comment.