Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/162 show execution time for retrieve and deploy #1056

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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