Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Jun 6, 2024
1 parent 8fb0174 commit f46ec8d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,19 +899,21 @@ export function _runTaskList(
// Queue is empty, no fetch of jobs in progress; let's fetch them.
getJobBaseline = getJobCounter;
nextJobs = (async () => {
const jobs = await baseGetJob(
compiledSharedOptions,
withPgClient,
tasks,
workerPool.id,
null,
getJobBatchSize,
);
jobQueue = jobs.reverse();
return jobs.length >= getJobBatchSize;
})().finally(() => {
nextJobs = null;
});
try {
const jobs = await baseGetJob(
compiledSharedOptions,
withPgClient,
tasks,
workerPool.id,
null,
getJobBatchSize,
);
jobQueue = jobs.reverse();
return jobs.length >= getJobBatchSize;
} finally {
nextJobs = null;
}
})();
}
const fetchedMax = await nextJobs;
const job = jobQueue.pop();
Expand Down

0 comments on commit f46ec8d

Please sign in to comment.