Prevent multiple instances of same background attachment job
This commit is contained in:
parent
368d5b7e4b
commit
3719724337
1 changed files with 6 additions and 1 deletions
|
@ -146,7 +146,12 @@ async function _maybeStartJob() {
|
|||
const jobs = nextJobs.slice(0, Math.min(needed, nextJobs.length));
|
||||
for (let i = 0, max = jobs.length; i < max; i += 1) {
|
||||
const job = jobs[i];
|
||||
_activeAttachmentDownloadJobs[job.id] = _runJob(job);
|
||||
const existing = _activeAttachmentDownloadJobs[job.id];
|
||||
if (existing) {
|
||||
logger.warn(`_maybeStartJob: Job ${job.id} is already running`);
|
||||
} else {
|
||||
_activeAttachmentDownloadJobs[job.id] = _runJob(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue