Skip to content

Commit

Permalink
Changed Logger calls into Debug/Warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Metropass committed Feb 19, 2021
1 parent ba4019d commit 3c8b025
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 1 addition & 5 deletions src/backend/feed/processor.js
Expand Up @@ -107,7 +107,6 @@ function articlesToPosts(articles, feed) {
articles.map(async (article) => {
try {
await Post.createFromArticle(article, feed);
//Add a debug log to see what is thrown?
} catch (error) {
// If this is just some missing data, ignore the post, otherwise throw.
if (error instanceof ArticleError) {
Expand All @@ -133,12 +132,10 @@ module.exports = async function processor(job) {
let info;
const [invalid, delayed] = await Promise.all([feed.isInvalid(), feed.isDelayed()]);
if (invalid) {
//Debug?
logger.info(`Skipping resource at ${feed.url}. Feed previously marked invalid`);
return;
}
if (delayed) {
//Debug?
logger.info(`Skipping resource at ${feed.url}. Feed previously marked for delayed processing`);
return;
}
Expand All @@ -147,7 +144,6 @@ module.exports = async function processor(job) {
// If we get no new version info, there's nothing left to do.
if (!info.shouldDownload) {
// Log some common cases we see, with a general message if none of these
//A lot of warnings & info, should we change it?
switch (info.status) {
case 304:
logger.info(`${info.status} Feed is up-to-date: ${feed.url}`);
Expand Down Expand Up @@ -211,7 +207,7 @@ module.exports = async function processor(job) {
}`
);
} else {
logger.error({ error }, `Unable to process feed ${feed.url}`);
logger.warn({ error }, `Unable to process feed ${feed.url}`);
throw error;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/backend/feed/worker.js
Expand Up @@ -33,8 +33,9 @@ exports.start = async function () {
logger.info('Connected to elasticsearch!');

const concurrency = getFeedWorkersCount();
//Change into debug?
logger.info(`Starting ${concurrency} instance${concurrency > 1 ? 's' : ''} of feed processor.`);
logger.debug(
`Starting ${concurrency} instance${concurrency > 1 ? 's' : ''} of feed processor.`
);
feedQueue.process(concurrency, path.resolve(__dirname, 'processor.js'));
return feedQueue;
} catch (error) {
Expand Down
9 changes: 3 additions & 6 deletions src/backend/lib/shutdown.js
Expand Up @@ -11,8 +11,7 @@ async function stopQueue() {
await feedQueue.close();
logger.info('Feed queue shut down.');
} catch (error) {
//Change to debug?
logger.error({ error }, 'Unable to close feed queue gracefully');
logger.debug({ error }, 'Unable to close feed queue gracefully');
}
}

Expand All @@ -25,8 +24,7 @@ async function stopWebServer() {
await serverClose();
logger.info('Web server shut down.');
} catch (error) {
// Change to debug?
logger.error({ error }, 'Unable to close web server gracefully');
logger.debug({ error }, 'Unable to close web server gracefully');
}
}

Expand All @@ -35,8 +33,7 @@ async function cleanShutdown() {
await Promise.all([stopQueue(), stopWebServer()]);
logger.info('Completing shut down.');
} catch (error) {
//Change to debug? Shutsdown, but dirty
logger.error({ error }, 'Failed to perform clean shutdown');
logger.debug({ error }, 'Failed to perform clean shutdown');
}
}

Expand Down

0 comments on commit 3c8b025

Please sign in to comment.