This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
export async function runPricingRefreshJob({ job, providerRegistry, pricingService }) {
|
||||
export async function processNextPersistentPricingRefreshJob({ jobRepository, pricingRefreshJob }) {
|
||||
const claimed = await jobRepository.claimNext();
|
||||
if (!claimed) return null;
|
||||
|
||||
const result = await pricingRefreshJob({ ...claimed, type: 'PRICING_REFRESH' });
|
||||
if (result.status === 'COMPLETED') {
|
||||
await jobRepository.complete(claimed.id, result.observations, result.valuation);
|
||||
} else {
|
||||
await jobRepository.fail(claimed.id, result.error);
|
||||
}
|
||||
return result;
|
||||
}export async function runPricingRefreshJob({ job, providerRegistry, pricingService }) {
|
||||
if (!job || job.type !== 'PRICING_REFRESH') {
|
||||
throw new Error('Unsupported pricing refresh job.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user