Browse Source

not allow lower than 20s for demo mode

1.7.X
LouisLam 3 years ago
parent
commit
5c89562650
  1. 8
      server/model/monitor.js
  2. 3
      server/server.js

8
server/model/monitor.js

@ -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);
} }

3
server/server.js

@ -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;

Loading…
Cancel
Save