mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
stats: Move http500
metric middleware to the beginning
This commit is contained in:
parent
f08a443497
commit
1434129a7b
2 changed files with 7 additions and 3 deletions
|
@ -112,6 +112,13 @@ exports.restartServer = async () => {
|
||||||
exports.server = http.createServer(app);
|
exports.server = http.createServer(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This error-handling middleware is installed first to ensure that no other middleware can
|
||||||
|
// prevent the stats from being updated.
|
||||||
|
app.use((err, req, res, next) => {
|
||||||
|
stats.meter('http500').mark();
|
||||||
|
next(err);
|
||||||
|
});
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
||||||
if (settings.ssl) {
|
if (settings.ssl) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const stats = require('../../stats');
|
|
||||||
|
|
||||||
exports.expressCreateServer = (hook_name, args, cb) => {
|
exports.expressCreateServer = (hook_name, args, cb) => {
|
||||||
exports.app = args.app;
|
exports.app = args.app;
|
||||||
|
|
||||||
|
@ -12,7 +10,6 @@ exports.expressCreateServer = (hook_name, args, cb) => {
|
||||||
// allowing you to respond however you like
|
// allowing you to respond however you like
|
||||||
res.status(500).send({error: 'Sorry, something bad happened!'});
|
res.status(500).send({error: 'Sorry, something bad happened!'});
|
||||||
console.error(err.stack ? err.stack : err.toString());
|
console.error(err.stack ? err.stack : err.toString());
|
||||||
stats.meter('http500').mark();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return cb();
|
return cb();
|
||||||
|
|
Loading…
Reference in a new issue