mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-03 00:12:01 +02:00
* Created new npm module: temptmp: This replaces node-temp usage & solves global temp file cleanup issue with concept of temp "sessions"
This commit is contained in:
parent
e10d085cab
commit
9525afddd3
5 changed files with 33 additions and 39 deletions
|
@ -18,7 +18,7 @@ const paths = require('path');
|
|||
const async = require('async');
|
||||
const fs = require('fs');
|
||||
const later = require('later');
|
||||
const temp = require('temp').track(); // track() cleans up temp dir/files for us
|
||||
const temptmp = require('temptmp').createTrackedSession('ftn_bso');
|
||||
const assert = require('assert');
|
||||
const gaze = require('gaze');
|
||||
const fse = require('fs-extra');
|
||||
|
@ -1153,14 +1153,14 @@ function FTNMessageScanTossModule() {
|
|||
};
|
||||
|
||||
this.createTempDirectories = function(cb) {
|
||||
temp.mkdir('enigftnexport-', (err, tempDir) => {
|
||||
temptmp.mkdir( { prefix : 'enigftnexport-' }, (err, tempDir) => {
|
||||
if(err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
self.exportTempDir = tempDir;
|
||||
|
||||
temp.mkdir('enigftnimport-', (err, tempDir) => {
|
||||
temptmp.mkdir( { prefix : 'enigftnimport-' }, (err, tempDir) => {
|
||||
self.importTempDir = tempDir;
|
||||
|
||||
cb(err);
|
||||
|
@ -1290,21 +1290,18 @@ FTNMessageScanTossModule.prototype.shutdown = function(cb) {
|
|||
//
|
||||
// Clean up temp dir/files we created
|
||||
//
|
||||
/*
|
||||
:TODO: fix global temp cleanup issue!!!
|
||||
|
||||
temp.cleanup((err, stats) => {
|
||||
const fullStats = Object.assign(stats, { exportTemp : this.exportTempDir, importTemp : this.importTempDir } );
|
||||
temptmp.cleanup( paths => {
|
||||
const fullStats = {
|
||||
exportDir : this.exportTempDir,
|
||||
importTemp : this.importTempDir,
|
||||
paths : paths,
|
||||
sessionId : temptmp.sessionId,
|
||||
};
|
||||
|
||||
if(err) {
|
||||
Log.warn(fullStats, 'Failed cleaning up temporary directories!');
|
||||
} else {
|
||||
Log.trace(fullStats, 'Temporary directories cleaned up');
|
||||
}
|
||||
Log.trace(fullStats, 'Temporary directories cleaned up');
|
||||
|
||||
FTNMessageScanTossModule.super_.prototype.shutdown.call(this, cb);
|
||||
});
|
||||
*/
|
||||
|
||||
FTNMessageScanTossModule.super_.prototype.shutdown.call(this, cb);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue