remove dead code and comments,

uptime calculation query bugfix
This commit is contained in:
Jakub Blažej 2022-01-07 20:21:57 +01:00
parent 9c069deb5d
commit 167bdaff21
2 changed files with 3 additions and 30 deletions

View file

@ -32,33 +32,6 @@ class Database {
*/ */
static backupPath = null; static backupPath = null;
/**
* Add patch filename in key
* Values:
* true: Add it regardless of order
* false: Do nothing
* { parents: []}: Need parents before add it
*/
// static patchList = {
// "patch-setting-value-type.sql": true,
// "patch-improve-performance.sql": true,
// "patch-2fa.sql": true,
// "patch-add-retry-interval-monitor.sql": true,
// "patch-incident-table.sql": true,
// "patch-group-table.sql": true,
// "patch-monitor-push_token.sql": true,
// "patch-http-monitor-method-body-and-headers.sql": true,
// "patch-2fa-invalidate-used-token.sql": true,
// "patch-notification_sent_history.sql": true,
// "patch-monitor-basic-auth.sql": true,
// }
/**
* The final version should be 10 after merged tag feature
* @deprecated Use patchList for any new feature
*/
static latestVersion = 10;
static noReject = true; static noReject = true;
static init(args) { static init(args) {
@ -144,7 +117,7 @@ class Database {
console.log("Waiting to close the database"); console.log("Waiting to close the database");
} }
} }
console.log("SQLite closed"); console.log("Database closed");
process.removeListener("unhandledRejection", listener); process.removeListener("unhandledRejection", listener);
} }

View file

@ -596,7 +596,7 @@ class Monitor extends BeanModel {
// including durationBefore (b1 to s), but we need only (s to n) so we have to subtract it // including durationBefore (b1 to s), but we need only (s to n) so we have to subtract it
let results = await R._knex.select({ let results = await R._knex.select({
first_status: 'time', first_status: 'status',
first_time: 'time', first_time: 'time',
first_duration: 'duration', first_duration: 'duration',
total_duration: R._knex.raw('sum(ping)'), total_duration: R._knex.raw('sum(ping)'),
@ -624,7 +624,7 @@ class Monitor extends BeanModel {
// subtract uptime_duration and total_duration which is outside the requested duration time window // subtract uptime_duration and total_duration which is outside the requested duration time window
totalDuration -= durationBefore; totalDuration -= durationBefore;
if (result.first_status == 1) if (result.first_status == UP)
uptimeDuration -= durationBefore; uptimeDuration -= durationBefore;