Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
singleLineLog: function singleLineLog(/* args */) {
return log.apply(log, arguments);
},
if (event.progress) {
status = `${event.status} ${event.progress}`;
}
if (event.id) {
statuses[event.id] = status;
}
// Print
let output = '';
const keys = Object.keys(statuses);
for (const key of keys) {
output += key + ': ' + statuses[key] + '\n';
}
if (!event.id) {
output += event.status;
}
slog(output);
};
this.docker.modem.followProgress(stream, onFinished, onProgress);
fail(msg) {
// if (!this.hasError()) {
// this.destroy();
// }
msg = msg ? '' + colors.red(msg) : '';
logger(msg);
process.stderr.write('\x1B[?25l');
if (cli.program.verbose) this.break();
}
eachEntry(function(user, blog, entry, _next){
var next = function(){
log(' ✔ All entries checked');
_next();
};
log(' ',entry.id + '.', entry.path);
if (type(entry, 'number')) {
return fakeEntry(blog.id, entry, next);
}
fix(blog, entry, function(entry, changes){
ensure(entry, Entry.model, true);
Entry.set(blog.id, entry.id, entry, function(err){
if (err) throw err;
Entry.get(blog.id, entry.id, function(savedEntry){
// The entry changed, lets work out
const fetchUserBeatmaps = (userId, modeId, scoresCount, retryCount = 0) => {
if (retryCount > 3) {
return Promise.reject(new Error('Too many retries'));
}
retryCount && oneLineLog(`Retry #${retryCount}`);
return axios.get(getUrl(userId, modeId, scoresCount)).catch(err => {
console.log('Error:', err.message);
return delay(5000).then(() => fetchUserBeatmaps(userId, modeId, scoresCount, retryCount + 1));
});
};
const fetchUser = (userId, modeId, retryCount = 0) => {
if (retryCount > 3) {
return Promise.reject(new Error('Too many retries'));
}
retryCount && oneLineLog(`Retry #${retryCount}`);
return axios.get(getUrl(userId, modeId)).catch(err => {
console.log('Error:', err.message);
return delay(5000).then(() => fetchUser(userId, modeId, retryCount + 1));
});
};
const fetchCountryPage = (modeText, page, country, retryCount = 0) => {
if (retryCount > 3) {
console.log('\nToo many retries, going forward');
return Promise.reject();
}
oneLineLog(`Fetching page #${page} (${modeText})` + (retryCount ? ` Retry #${retryCount}` : ''));
return axios.get(getUsersUrl(modeText, page, country)).catch(err => {
console.log('Error:', err.message);
console.log(err);
return delay(10000).then(() => fetchCountryPage(modeText, page, country, retryCount + 1));
});
};
success: function (scriptOutput) {
if (scriptOutput.body && scriptOutput.body.indexOf('All done!') > -1) {
console.log('Deployment finished.')
console.log('The site should be available at ' + sitename + '.azurewebsites.net.');
clearInterval(spinnerInterval);
return cb();
} else {
if (scriptOutput.body) {
log(scriptOutput.body);
process.stdout.write('\r \033[36mcomputing\033[m ' + spinner.next());
}
setTimeout(getLog, 400);
}
}
});
const run = function(implementation, randomizer) {
const res = [];
runConfiguration.forEach((conf, idx) => {
res.push(implementation.run(Object.assign(conf, { randomizer })));
log(`${idx + 1}/${runConfiguration.length}`);
log.clear();
});
log('');
const table = new Table({ head: headerItems });
libraries.forEach((lib) => addRow(lib, res, table));
console.log(table.toString());
};
const run = function(implementation, randomizer) {
const res = [];
runConfiguration.forEach((conf, idx) => {
res.push(implementation.run(Object.assign(conf, { randomizer })));
log(`${idx + 1}/${runConfiguration.length}`);
log.clear();
});
log('');
const table = new Table({ head: headerItems });
librariesToRun.forEach((lib) => addRow(lib, res, table));
console.log(table.toString());
};