Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #122: add logging to inform user of Redis connection failure #553

Merged
merged 4 commits into from
Jan 22, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/backend/lib/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { logger } = require('../utils/logger');

const client = createRedisClient();
const subscriber = createRedisClient();
let redisErrorLogged = false;
humphd marked this conversation as resolved.
Show resolved Hide resolved

/**
* Create a Queue with the given `name` (String).
Expand All @@ -31,7 +32,18 @@ function createQueue(name) {
})
.on('error', err => {
// An error occurred
logger.error({ err }, `Queue ${name} error`);
if (err.code === 'ECONNREFUSED') {
if (!redisErrorLogged) {
Silvyre marked this conversation as resolved.
Show resolved Hide resolved
logger.error(
'\n\n\t💡 It appears that Redis is not running on your machine.',
'\n\t Please see our documentation for how to install and run Redis:',
'\n\t https://github.com/Seneca-CDOT/telescope/blob/master/docs/CONTRIBUTING.md\n'
);
redisErrorLogged = true;
}
} else {
logger.error({ err }, `Queue ${name} error`);
}
})
.on('waiting', jobID => {
// A job is waiting for the next idling worker
Expand Down