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 { BeanModel } = require("redbean-node/dist/bean-model");
const { Notification } = require("../notification");
const { demoMode } = require("../server");
const version = require("../../package.json").version;
/**
@ -334,6 +335,13 @@ class Monitor extends BeanModel {
previousBeat = bean;
if (! this.isStop) {
if (demoMode) {
if (beatInterval < 20) {
beatInterval = 20;
}
}
this.heartbeatInterval = setTimeout(beat, beatInterval * 1000);
}

View file

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