Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
re-add dynamic message for spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettKercher committed Jun 12, 2018
1 parent 9b9ac90 commit 8973523
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cleanup.js
Expand Up @@ -82,14 +82,13 @@ cache.on('cleanup_delete_finish', data => {
}
});

const msg = 'Gathering cache files for expiration';
let spinner = null;

if(logLevel < consts.LOG_DBG && logLevel >= consts.LOG_INFO) {
spinner = ora({color: 'white'});

cache.on('cleanup_search_progress', data => {
spinner.text = `${msg} (${data.deleteCount} of ${data.cacheCount} files, ${filesize(data.deleteSize)})`;
spinner.text = `${data.msg} (${data.deleteCount} of ${data.cacheCount} files, ${filesize(data.deleteSize)})`;
});

cache.on('cleanup_search_finish', () => {
Expand All @@ -98,11 +97,12 @@ if(logLevel < consts.LOG_DBG && logLevel >= consts.LOG_INFO) {

} else if(logLevel === consts.LOG_DBG) {
cache.on('cleanup_search_progress', data => {
const txt = `${msg} (${data.deleteCount} of ${data.cacheCount} files, ${filesize(data.deleteSize)})`;
const txt = `${data.msg} (${data.deleteCount} of ${data.cacheCount} files, ${filesize(data.deleteSize)})`;
helpers.log(consts.LOG_DBG, txt);
});
}

const msg = 'Gathering cache files for expiration';
function doCleanup() {
if (spinner) spinner.start(msg);
cache.cleanup(dryRun)
Expand Down

0 comments on commit 8973523

Please sign in to comment.