feat: cli exits properly; disable excessive db logging

This commit is contained in:
Vyacheslav Matyukhin 2022-03-27 01:48:44 +03:00
parent 2398394227
commit 8cfdaddd7a
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
2 changed files with 4 additions and 8 deletions

View File

@ -64,7 +64,7 @@ export const runPgCommand = async ({ command, pool }) => {
let result; let result;
try { try {
let response = await client.query(command); let response = await client.query(command);
console.log(response); // console.log(response);
result = { results: response ? response.rows : null }; result = { results: response ? response.rows : null };
} catch (error) { } catch (error) {
console.log(error); console.log(error);

View File

@ -23,7 +23,6 @@ let functions = [
pgInitialize, pgInitialize,
rebuildFrontpage, rebuildFrontpage,
]; ];
let functionNames = functions.map((fun) => fun.name);
let generateWhatToDoMessage = () => { let generateWhatToDoMessage = () => {
let l = platformFetchers.length; let l = platformFetchers.length;
@ -68,13 +67,13 @@ let commandLineUtility = async () => {
let executeoption = async (option) => { let executeoption = async (option) => {
option = Number(option); option = Number(option);
//console.log(functionNames[option])
if (option < 0) { if (option < 0) {
console.log(`Error, ${option} < 0 or ${option} < 0`); console.log(`Error, ${option} < 0`);
} else if (option < functions.length) { } else if (option < functions.length) {
console.log(`Running: ${functions[option].name}\n`); console.log(`Running: ${functions[option].name}\n`);
await tryCatchTryAgain(functions[option]); await tryCatchTryAgain(functions[option]);
} }
process.exit();
}; };
if (process.argv.length == 3) { if (process.argv.length == 3) {
@ -83,14 +82,11 @@ let commandLineUtility = async () => {
if (!isNaN(optionNum)) { if (!isNaN(optionNum)) {
await executeoption(optionNum); await executeoption(optionNum);
} else if (option == "all") { } else if (option == "all") {
await executeoption(functions.length - 1); // 15 = execute all fetchers await executeoption(functions.length - 3); // doEverything
} else { } else {
await whattodo(whattodoMessage, executeoption); await whattodo(whattodoMessage, executeoption);
} }
} else await whattodo(whattodoMessage, executeoption); } else await whattodo(whattodoMessage, executeoption);
}; };
// console.log("1")
// console.log(process.argv)
commandLineUtility(); commandLineUtility();
// doEverything()