Skip to content

Commit

Permalink
Catch if the queue is not up
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Jun 28, 2024
1 parent 73b88fe commit 8934f19
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
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}

0 comments on commit 8934f19

Please sign in to comment.