not allow lower than 20s for demo mode

This commit is contained in:
LouisLam 2021-10-10 02:23:27 +08:00
parent 8d8d5987e7
commit 5c89562650
2 changed files with 10 additions and 1 deletions

View file

@ -11,6 +11,7 @@ const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalCli
const { R } = require("redbean-node"); const { R } = require("redbean-node");
const { BeanModel } = require("redbean-node/dist/bean-model"); const { BeanModel } = require("redbean-node/dist/bean-model");
const { Notification } = require("../notification"); const { Notification } = require("../notification");
const { demoMode } = require("../server");
const version = require("../../package.json").version; const version = require("../../package.json").version;
/** /**
@ -334,6 +335,13 @@ class Monitor extends BeanModel {
previousBeat = bean; previousBeat = bean;
if (! this.isStop) { if (! this.isStop) {
if (demoMode) {
if (beatInterval < 20) {
beatInterval = 20;
}
}
this.heartbeatInterval = setTimeout(beat, beatInterval * 1000); this.heartbeatInterval = setTimeout(beat, beatInterval * 1000);
} }

View file

@ -66,12 +66,13 @@ const sslCert = process.env.SSL_CERT || args["ssl-cert"] || undefined;
// Demo Mode? // Demo Mode?
const demoMode = args["demo"] || false; const demoMode = args["demo"] || false;
exports.demoMode = demoMode;
if (demoMode) { if (demoMode) {
console.log("==== Demo Mode ===="); console.log("==== Demo Mode ====");
} }
console.log("Creating express and socket.io instance") console.log("Creating express and socket.io instance");
const app = express(); const app = express();
let server; let server;