mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-11 16:26:20 +00:00
These asserts weren't true
This commit is contained in:
@@ -92,7 +92,6 @@ export default class Processor {
|
||||
// If the worker is unused for 10 seconds, remove it to save memory.
|
||||
this._workerTimeoutId = self.setTimeout(
|
||||
() => {
|
||||
if (this._busy) throw Error("Worker shouldn't be busy");
|
||||
if (!this._worker) return;
|
||||
this._worker.terminate();
|
||||
this._worker = undefined;
|
||||
@@ -104,14 +103,14 @@ export default class Processor {
|
||||
/** Abort the current job, if any */
|
||||
abortCurrent() {
|
||||
if (!this._busy) return;
|
||||
if (!this._worker || !this._abortRejector) {
|
||||
throw Error("There must be a worker/rejector if it's busy");
|
||||
}
|
||||
if (!this._abortRejector) throw Error("There must be a rejector if it's busy");
|
||||
this._abortRejector(new DOMException('Aborted', 'AbortError'));
|
||||
this._worker.terminate();
|
||||
this._worker = undefined;
|
||||
this._abortRejector = undefined;
|
||||
this._busy = false;
|
||||
|
||||
if (!this._worker) return;
|
||||
this._worker.terminate();
|
||||
this._worker = undefined;
|
||||
}
|
||||
|
||||
// Off main thread jobs:
|
||||
|
||||
Reference in New Issue
Block a user