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

Catch if the queue is not up #53

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions server/src/middleware/errorhandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const error500 = function (error, request, response) {
title: '500: Something is broken?',
description: '500',
nconf,
message: error.message,
getText
});
};
45 changes: 27 additions & 18 deletions server/src/routes/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,35 @@ const require = createRequire(import.meta.url);
const version = require('../../../package.json').version;

index.get('/', async function (request, response) {
const testDomain = nconf.get('validTestDomains');
const testRunners = getTestRunners();
const queueNamesAndSize = {};
for (const runner of testRunners) {
for (const setup of runner.setup) {
queueNamesAndSize[setup.queue] = await getQueueSize(setup.queue);
try {
const testDomain = nconf.get('validTestDomains');
const testRunners = getTestRunners();
const queueNamesAndSize = {};
for (const runner of testRunners) {
for (const setup of runner.setup) {
queueNamesAndSize[setup.queue] = await getQueueSize(setup.queue);
}
}
response.render('index', {
bodyId: 'index',
title: getText('index.pagetitle'),
description: getText('index.pagedescripton'),
serverConfig: testRunners,
testDomains: testDomain,
nconf,
getText,
queueNamesAndSize,
serverVersion: version
});
} catch {
response.render('500', {
title: '500: Something is broken?',
description: '500',
message: 'The queue system is down, check your logs',
nconf,
getText
});
}

response.render('index', {
bodyId: 'index',
title: getText('index.pagetitle'),
description: getText('index.pagedescripton'),
serverConfig: testRunners,
testDomains: testDomain,
nconf,
getText,
queueNamesAndSize,
serverVersion: version
});
});

index.post(
Expand Down
14 changes: 10 additions & 4 deletions server/views/500.pug
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
extends ./layouts/default.pug
block content

block content
section.section
.container
p.has-text-centered.mb-2
img(src='/img/404.png' alt='Ooops something is broken?')
.container
.level
.level-item.has-text-centered
img(src=nconf.get('html:logo:path') width=nconf.get('html:logo:width') alt=nconf.get('html:logo:alt'))
.level
.level-item.has-text-centered
p.control.is-expanded
label.label.is-large
| #{message}