mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-14 00:22:34 +02:00
remove dead code and comments,
uptime calculation query bugfix
This commit is contained in:
parent
9c069deb5d
commit
167bdaff21
2 changed files with 3 additions and 30 deletions
|
@ -32,33 +32,6 @@ class Database {
|
|||
*/
|
||||
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 init(args) {
|
||||
|
@ -144,7 +117,7 @@ class Database {
|
|||
console.log("Waiting to close the database");
|
||||
}
|
||||
}
|
||||
console.log("SQLite closed");
|
||||
console.log("Database closed");
|
||||
|
||||
process.removeListener("unhandledRejection", listener);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
let results = await R._knex.select({
|
||||
first_status: 'time',
|
||||
first_status: 'status',
|
||||
first_time: 'time',
|
||||
first_duration: 'duration',
|
||||
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
|
||||
totalDuration -= durationBefore;
|
||||
if (result.first_status == 1)
|
||||
if (result.first_status == UP)
|
||||
uptimeDuration -= durationBefore;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue