averaging fixed
This commit is contained in:
8
dist/missingeventdetector.js
vendored
8
dist/missingeventdetector.js
vendored
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const log = require("./log");
|
||||
const CallChain = require("./callchain");
|
||||
const Processor = require("./processor");
|
||||
const CHECK_PERIOD = 10; // seconds
|
||||
const CHECK_PERIOD = 60; // seconds
|
||||
class ClientEntry {
|
||||
}
|
||||
class MissingEventProcessor extends Processor.AProcessor {
|
||||
@ -28,7 +28,9 @@ class MissingEventProcessor extends Processor.AProcessor {
|
||||
clientEntry.delay = currentTime - clientEntry.lastEvent;
|
||||
clientEntry.lastEvent = currentTime;
|
||||
clientEntry.count += 1;
|
||||
clientEntry.delaySum += clientEntry.delay;
|
||||
if (clientEntry.count >= 1) {
|
||||
clientEntry.delaySum += clientEntry.delay;
|
||||
}
|
||||
clientEntry.avgDelay = clientEntry.delaySum / clientEntry.count;
|
||||
this.clientMap.set(client, clientEntry);
|
||||
log.info(`Entry for ${client} updated`);
|
||||
@ -38,7 +40,7 @@ class MissingEventProcessor extends Processor.AProcessor {
|
||||
clientEntry.client = client;
|
||||
clientEntry.lastEvent = currentTime;
|
||||
clientEntry.delay = 0;
|
||||
clientEntry.count = 0;
|
||||
clientEntry.count = -1;
|
||||
clientEntry.delaySum = 0;
|
||||
clientEntry.avgDelay = 0;
|
||||
this.clientMap.set(client, clientEntry);
|
||||
|
Reference in New Issue
Block a user