Comparing version 1.8.11 to 1.9.0
@@ -72,2 +72,3 @@ 'use strict'; | ||
var that = this; | ||
var cleanup; | ||
@@ -93,3 +94,3 @@ var onData = function (data) { | ||
var cleanup = function () { | ||
cleanup = function () { | ||
readable.removeListener('data', onData); | ||
@@ -96,0 +97,0 @@ readable.removeListener('end', onEnd); |
@@ -11,3 +11,17 @@ 'use strict'; | ||
var KEEP_DAYS = 7; | ||
var SECONDS_PER_DAY = 86400; | ||
var getDate = function(ymd) { | ||
ymd = ymd.toString(); | ||
var d = ymd.substr(0, 4) + '-' + ymd.substr(4, 2) + '-' + ymd.substr(6, 2); | ||
return new Date(d); | ||
}; | ||
var isOldFile = function(today, date, days) { | ||
var todaySeconds = getDate(today) / 1000; | ||
var dateSeconds = getDate(date) / 1000; | ||
var diff = days * SECONDS_PER_DAY; | ||
return todaySeconds - dateSeconds > diff; | ||
}; | ||
var removeFiles = function (logdir, files, callback) { | ||
@@ -48,2 +62,3 @@ var count = files.length; | ||
var today = parseInt(helper.getYYYYMMDD(now), 10); | ||
var logs = files.filter(function (filename) { | ||
@@ -53,3 +68,3 @@ var matched = filename.match(patt); | ||
var date = parseInt(matched[2]); | ||
if (date < today - KEEP_DAYS) { | ||
if (isOldFile(today, date, KEEP_DAYS)) { | ||
// 删除KEEP_DAYS天前的node/access日志 | ||
@@ -56,0 +71,0 @@ return true; |
@@ -105,3 +105,7 @@ 'use strict'; | ||
parsers.set(key, new Parser(MAX_ERROR_COUNT)); | ||
keyMap.set(key, getRealPath(key)); | ||
var realPath = getRealPath(key); | ||
if (fs.existsSync(realPath)) { | ||
map.set(realPath, fs.statSync(realPath).size); | ||
} | ||
keyMap.set(key, realPath); | ||
} | ||
@@ -108,0 +112,0 @@ } |
@@ -94,3 +94,3 @@ 'use strict'; | ||
// can not find MemTotal in meminfo, impossible | ||
return os.totalmem() | ||
return os.totalmem(); | ||
}; | ||
@@ -97,0 +97,0 @@ |
{ | ||
"name": "agentx", | ||
"version": "1.8.11", | ||
"version": "1.9.0", | ||
"description": "agentx is powered by alinode", | ||
"scripts": { | ||
"test": "make test", | ||
"test-cov": "make test-cov" | ||
"lint": "eslint lib test *.js", | ||
"test": "mocha -R spec test/**/*.test.js", | ||
"cov": "nyc --reporter=html --reporter=text mocha -t 3000 -R spec test/**/*.test.js", | ||
"ci": "npm run lint && npm run cov && codecov" | ||
}, | ||
@@ -23,7 +25,9 @@ "bin": { | ||
"devDependencies": { | ||
"codecov": "^3.0.0", | ||
"coveralls": "^2.11.6", | ||
"expect.js": "*", | ||
"istanbul": "*", | ||
"eslint": "^4.19.1", | ||
"expect.js": "^0.3.1", | ||
"mm": "^2.2.0", | ||
"mocha": "^3", | ||
"nyc": "^11.6.0", | ||
"rewire": "^2.5.2" | ||
@@ -30,0 +34,0 @@ }, |
@@ -44,15 +44,11 @@ #!/usr/bin/env node | ||
count: 1 | ||
}) | ||
.on('fork', function (client) { | ||
}).on('fork', function (client) { | ||
console.log('[%s] [client:%d] new client start', Date(), client.pid); | ||
}) | ||
.on('disconnect', function (client) { | ||
}).on('disconnect', function (client) { | ||
console.error('[%s] [%s] client:%s disconnect, suicide: %s.', | ||
Date(), process.pid, client.pid, client.suicide); | ||
}) | ||
.on('expectedExit', function (client, code, signal) { | ||
}).on('expectedExit', function (client, code, signal) { | ||
console.log('[%s] [%s], client %s died (code: %s, signal: %s)', Date(), | ||
process.pid, client.pid, code, signal); | ||
}) | ||
.on('unexpectedExit', function (client, code, signal) { | ||
}).on('unexpectedExit', function (client, code, signal) { | ||
var err = new Error(util.format('client %s died (code: %s, signal: %s)', | ||
@@ -59,0 +55,0 @@ client.pid, code, signal)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46917
18
1530
8
14
2