Should be a final ulitmate fix for request timeout issue (#4045)

* Try to fix timeout again

* Ops
This commit is contained in:
Louis Lam 2023-11-18 01:17:54 +08:00 committed by GitHub
parent 40d6a21453
commit f0975cd929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

7
db/patch-timeout.sql Normal file
View file

@ -0,0 +1,7 @@
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
BEGIN TRANSACTION;
UPDATE monitor SET timeout = (interval * 0.8)
WHERE timeout IS NULL OR timeout <= 0;
COMMIT;

View file

@ -83,6 +83,7 @@ class Database {
"patch-add-gamedig-given-port.sql": true, "patch-add-gamedig-given-port.sql": true,
"patch-notification-config.sql": true, "patch-notification-config.sql": true,
"patch-fix-kafka-producer-booleans.sql": true, "patch-fix-kafka-producer-booleans.sql": true,
"patch-timeout.sql": true,
}; };
/** /**

View file

@ -369,7 +369,7 @@ class Monitor extends BeanModel {
// Runtime patch timeout if it is 0 // Runtime patch timeout if it is 0
// See https://github.com/louislam/uptime-kuma/pull/3961#issuecomment-1804149144 // See https://github.com/louislam/uptime-kuma/pull/3961#issuecomment-1804149144
if (this.timeout <= 0) { if (!this.timeout || this.timeout <= 0) {
this.timeout = this.interval * 1000 * 0.8; this.timeout = this.interval * 1000 * 0.8;
} }