mirror of
https://github.com/EveryInc/compound-engineering-plugin.git
synced 2026-11-15 09:31:17 +01:00
9 lines
211 B
JavaScript
9 lines
211 B
JavaScript
export async function claim(db, now) {
|
|
return db.transaction(async tx => {
|
|
const job = await tx.firstReady(now);
|
|
if (!job) return null;
|
|
await tx.lease(job.id, now + 30000);
|
|
return job;
|
|
});
|
|
}
|