mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Rename files
This commit is contained in:
17
ts/util/JobQueue.std.ts
Normal file
17
ts/util/JobQueue.std.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import PQueue from 'p-queue';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.std.js';
|
||||
|
||||
function createJobQueue(label: string) {
|
||||
const jobQueue = new PQueue({ concurrency: 1 });
|
||||
|
||||
return (job: () => Promise<void>, id = '') => {
|
||||
const taskWithTimeout = createTaskWithTimeout(job, `${label} ${id}`);
|
||||
|
||||
return jobQueue.add(taskWithTimeout);
|
||||
};
|
||||
}
|
||||
|
||||
export const storageJobQueue = createJobQueue('storageService');
|
||||
Reference in New Issue
Block a user