Nomenclature
This commit is contained in:
parent
381bffabbf
commit
1026974e23
2 changed files with 8 additions and 8 deletions
|
@ -201,14 +201,14 @@ const ffmpegExec = async (
|
|||
|
||||
/** Lazily create a singleton instance of our worker */
|
||||
class WorkerFactory {
|
||||
private _worker: ComlinkWorker<typeof DedicatedFFmpegWorker>;
|
||||
private _comlinkWorker: ComlinkWorker<typeof DedicatedFFmpegWorker>;
|
||||
private _instance: Promise<Remote<DedicatedFFmpegWorker>>;
|
||||
|
||||
async instance() {
|
||||
if (!this._instance) {
|
||||
const worker = createWorker();
|
||||
this._worker = worker;
|
||||
this._instance = worker.remote;
|
||||
const comlinkWorker = createComlinkWorker();
|
||||
this._comlinkWorker = comlinkWorker;
|
||||
this._instance = comlinkWorker.remote;
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class WorkerFactory {
|
|||
|
||||
const workerFactory = new WorkerFactory();
|
||||
|
||||
const createWorker = () =>
|
||||
const createComlinkWorker = () =>
|
||||
new ComlinkWorker<typeof DedicatedFFmpegWorker>(
|
||||
"ffmpeg-worker",
|
||||
new Worker(new URL("worker/ffmpeg.worker.ts", import.meta.url)),
|
||||
|
|
|
@ -30,7 +30,7 @@ class HEICConverter {
|
|||
if (this.workerPool.length > 0) return;
|
||||
this.workerPool = [];
|
||||
for (let i = 0; i < WORKER_POOL_SIZE; i++)
|
||||
this.workerPool.push(createWorker());
|
||||
this.workerPool.push(createComlinkWorker());
|
||||
}
|
||||
|
||||
async convert(fileBlob: Blob): Promise<Blob> {
|
||||
|
@ -96,7 +96,7 @@ class HEICConverter {
|
|||
} catch (e) {
|
||||
log.error("heic conversion failed", e);
|
||||
convertWorker.terminate();
|
||||
this.workerPool.push(createWorker());
|
||||
this.workerPool.push(createComlinkWorker());
|
||||
throw e;
|
||||
}
|
||||
}, WAIT_TIME_BEFORE_NEXT_ATTEMPT_IN_MICROSECONDS),
|
||||
|
@ -117,7 +117,7 @@ class HEICConverter {
|
|||
/** The singleton instance of {@link HEICConverter}. */
|
||||
const converter = new HEICConverter();
|
||||
|
||||
const createWorker = () =>
|
||||
const createComlinkWorker = () =>
|
||||
new ComlinkWorker<typeof DedicatedHEICConvertWorker>(
|
||||
"heic-convert-worker",
|
||||
new Worker(new URL("worker/heic-convert.worker.ts", import.meta.url)),
|
||||
|
|
Loading…
Add table
Reference in a new issue