feat(tests): new scanner test

This commit is contained in:
Alexey Kasyanchuk
2018-02-03 22:48:41 +03:00
parent 6646381a49
commit b205245e40
6 changed files with 38 additions and 74 deletions

View File

@ -5,7 +5,7 @@ let keepTime = process.hrtime()
let keepUsage = process.cpuUsage()
let sw = false
setInterval(() => {
const cpuTimer = setInterval(() => {
if(!sw) {
keepTime = process.hrtime();
keepUsage = process.cpuUsage();
@ -14,9 +14,11 @@ setInterval(() => {
startTime = keepTime;
startUsage = keepUsage;
sw = false;
}
}
}, 500)
cpuTimer.unref()
module.exports = () => {
function secNSec2ms (secNSec) {
return secNSec[0] * 1000 + secNSec[1] / 1000000

View File

@ -3,7 +3,8 @@
module.exports = class {
constructor() {
this.generate()
setInterval(()=> this.generate(), 60000*15)
const it = setInterval(() => this.generate(), 60000*15)
it.unref()
}
isValid(t) {

View File

@ -43,7 +43,7 @@ const fs = require('fs');
const debug = require('debug')('config')
let configPath = 'config.json'
if(app.getPath("userData") && app.getPath("userData").length > 0)
if(app && app.getPath("userData") && app.getPath("userData").length > 0)
{
configPath = app.getPath("userData") + '/config.json'
}