small fixes

This commit is contained in:
zadam
2020-08-31 23:13:39 +02:00
parent 574b71de63
commit a15f8d7e11
3 changed files with 9 additions and 7 deletions

View File

@@ -65,14 +65,16 @@ function prepareSqlForLike(prefix, str, suffix) {
return `'${prefix}${value}${suffix}' ESCAPE '\\'`;
}
function stopWatch(what, func) {
function stopWatch(what, func, timeLimit = 0) {
const start = Date.now();
const ret = func();
const tookMs = Date.now() - start;
log.info(`${what} took ${tookMs}ms`);
if (tookMs >= timeLimit) {
log.info(`${what} took ${tookMs}ms`);
}
return ret;
}