averaging fixed
This commit is contained in:
@ -3,7 +3,7 @@ import * as CallChain from './callchain'
|
||||
import * as Processor from './processor'
|
||||
|
||||
|
||||
const CHECK_PERIOD : number = 10 // seconds
|
||||
const CHECK_PERIOD : number = 60 // seconds
|
||||
|
||||
class ClientEntry {
|
||||
client : string
|
||||
@ -39,7 +39,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`)
|
||||
@ -48,7 +50,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