mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Fixing job progress
This commit is contained in:
parent
d606df9479
commit
e4710da4e5
@ -76,7 +76,31 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const processOneFile = async () => {
|
|
||||||
|
|
||||||
|
if (!this.config.indexedOnly) {
|
||||||
|
if (this.directoryQueue.length > 0) {
|
||||||
|
await this.loadADirectoryFromDisk();
|
||||||
|
return true
|
||||||
|
} else if (this.fileQueue.length > 0) {
|
||||||
|
this.Progress.Left = this.fileQueue.length;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.DBProcessing.initiated) {
|
||||||
|
this.Progress.log('Counting files from db');
|
||||||
|
Logger.silly(LOG_TAG, 'Counting files from db');
|
||||||
|
this.Progress.All = await this.countMediaFromDB();
|
||||||
|
this.Progress.log('Found:' + this.Progress.All);
|
||||||
|
Logger.silly(LOG_TAG, 'Found:' + this.Progress.All);
|
||||||
|
this.DBProcessing.initiated = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.fileQueue.length === 0) {
|
||||||
|
await this.loadMediaFilesFromDB();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const filePath = this.fileQueue.shift();
|
const filePath = this.fileQueue.shift();
|
||||||
try {
|
try {
|
||||||
if ((await this.shouldProcess(filePath)) === true) {
|
if ((await this.shouldProcess(filePath)) === true) {
|
||||||
@ -97,31 +121,6 @@ export abstract class FileJob<S extends { indexedOnly?: boolean } = { indexedOnl
|
|||||||
'Error during processing file:' + filePath + ', ' + e.toString()
|
'Error during processing file:' + filePath + ', ' + e.toString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (!this.config.indexedOnly) {
|
|
||||||
if (this.directoryQueue.length > 0) {
|
|
||||||
await this.loadADirectoryFromDisk();
|
|
||||||
} else if (this.fileQueue.length > 0) {
|
|
||||||
this.Progress.Left = this.fileQueue.length;
|
|
||||||
await processOneFile();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!this.DBProcessing.initiated) {
|
|
||||||
this.Progress.log('Counting files from db');
|
|
||||||
Logger.silly(LOG_TAG, 'Counting files from db');
|
|
||||||
this.Progress.All = await this.countMediaFromDB();
|
|
||||||
Logger.silly(LOG_TAG, 'Found:' + this.Progress.All);
|
|
||||||
this.DBProcessing.initiated = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (this.fileQueue.length === 0) {
|
|
||||||
await this.loadMediaFilesFromDB();
|
|
||||||
} else {
|
|
||||||
this.Progress.Left = this.fileQueue.length;
|
|
||||||
await processOneFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -125,14 +125,3 @@ export class DiskManagerTH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ThumbnailTH
|
|
||||||
extends ThreadPool<void>
|
|
||||||
implements ITaskExecuter<RendererInput, void>
|
|
||||||
{
|
|
||||||
execute(input: RendererInput): Promise<void> {
|
|
||||||
return super.executeTask({
|
|
||||||
type: WorkerTaskTypes.thumbnail,
|
|
||||||
input,
|
|
||||||
} as ThumbnailTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user