* Don't archive non-good non-pkt files (e.g. TICs that are *not* rejected)

* asyncSeries() for TIC import (SQLite transaction)
This commit is contained in:
Bryan Ashby 2017-03-10 21:13:30 -07:00
parent 043987bacb
commit 221ec08bc8
1 changed files with 6 additions and 2 deletions

View File

@ -1041,10 +1041,14 @@ function FTNMessageScanTossModule() {
} }
archivePath = paths.join(self.moduleConfig.paths.retain, `good-pkt-${ts}--${fn}`); archivePath = paths.join(self.moduleConfig.paths.retain, `good-pkt-${ts}--${fn}`);
} else { } else if('good' !== status) {
archivePath = paths.join(self.moduleConfig.paths.reject, `${status}-${type}--${ts}-${fn}`); archivePath = paths.join(self.moduleConfig.paths.reject, `${status}-${type}--${ts}-${fn}`);
} else {
return cb(null); // don't archive non-good/pkt files
} }
Log.debug( { origPath : origPath, archivePath : archivePath, type : type, status : status }, 'Archiving import file');
fse.copy(origPath, archivePath, err => { fse.copy(origPath, archivePath, err => {
if(err) { if(err) {
Log.warn( { error : err.message, origPath : origPath, archivePath : archivePath, type : type, status : status }, 'Failed to archive packet file'); Log.warn( { error : err.message, origPath : origPath, archivePath : archivePath, type : type, status : status }, 'Failed to archive packet file');
@ -1528,7 +1532,7 @@ FTNMessageScanTossModule.prototype.processTicFilesInDirectory = function(importD
}); });
}, },
function process(ticFilesInfo, callback) { function process(ticFilesInfo, callback) {
async.each(ticFilesInfo, (ticFileInfo, nextTicInfo) => { async.eachSeries(ticFilesInfo, (ticFileInfo, nextTicInfo) => {
self.processSingleTicFile(ticFileInfo, err => { self.processSingleTicFile(ticFileInfo, err => {
if(err) { if(err) {
// archive rejected TIC stuff (.TIC + attach) // archive rejected TIC stuff (.TIC + attach)