um-react/src/util/DecryptionQueue.ts

16 lines
666 B
TypeScript
Raw Normal View History

import type { DecryptCommandPayload } from '~/decrypt-worker/types';
2023-05-17 23:04:37 +00:00
import { DECRYPTION_WORKER_ACTION_NAME, DecryptionResult } from '~/decrypt-worker/constants';
2023-05-16 21:47:47 +00:00
import { ConcurrentQueue } from './ConcurrentQueue';
import { WorkerClientBus } from './WorkerEventBus';
export class DecryptionQueue extends ConcurrentQueue<DecryptCommandPayload, DecryptionResult> {
2023-05-16 21:47:47 +00:00
constructor(private workerClientBus: WorkerClientBus<DECRYPTION_WORKER_ACTION_NAME>, maxQueue?: number) {
super(maxQueue);
}
async handler(item: DecryptCommandPayload): Promise<DecryptionResult> {
return this.workerClientBus.request(DECRYPTION_WORKER_ACTION_NAME.DECRYPT, item);
2023-05-16 21:47:47 +00:00
}
}