This commit is contained in:
@@ -110,4 +110,21 @@ export async function runImageDerivativeJob({ job, loadSource, processor }) {
|
||||
failedAt: new Date(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function processNextPersistentImageDerivativeJob({ jobRepository, loadSource, processor }) {
|
||||
const claimed = await jobRepository.claimNext();
|
||||
|
||||
if (!claimed) return null;
|
||||
|
||||
const job = { ...claimed, type: 'IMAGE_DERIVATIVES' };
|
||||
const result = await runImageDerivativeJob({ job, loadSource, processor });
|
||||
|
||||
if (result.status === 'COMPLETED') {
|
||||
await jobRepository.complete(claimed.id, result.derivatives);
|
||||
} else {
|
||||
await jobRepository.fail(claimed.id, result.error);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user