Небольшие исправления, queue теперь в одном экземпляре на класс

This commit is contained in:
Book Pauk
2020-01-28 14:51:09 +07:00
parent 76f7d7bc90
commit 1226acefd6
2 changed files with 5 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ const utils = require('../utils');
const log = new (require('../AppLogger'))().log;//singleton
const cleanDirPeriod = 60*60*1000;//1 раз в час
const queue = new LimitedQueue(5, 100, 5*60*1000);//5 минут ожидание подвижек
let instance = null;
@@ -27,7 +28,6 @@ class ReaderWorker {
this.config.tempPublicDir = `${config.publicDir}/tmp`;
fs.ensureDirSync(this.config.tempPublicDir);
this.queue = new LimitedQueue(5, 100, 5*60*1000);//5 минут ожидание подвижек
this.workerState = new WorkerState();
this.down = new FileDownloader(config.maxUploadFileSize);
this.decomp = new FileDecompressor(2*config.maxUploadFileSize);
@@ -64,7 +64,7 @@ class ReaderWorker {
wState.set({state: 'queue', step: 1, totalSteps: 1});
try {
let qSize = 0;
q = await this.queue.get((place) => {
q = await queue.get((place) => {
wState.set({place, progress: (qSize ? Math.round((qSize - place)/qSize*100) : 0)});
if (!qSize)
qSize = place;