Skip to content

Commit

Permalink
worker: log claim duration
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjclark committed Sep 25, 2024
1 parent 30a70ab commit 75c6529
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/ws-worker/src/api/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ const claim = (
}
logger.debug(`requesting run (capacity ${activeWorkers}/${maxWorkers})`);

const start = Date.now()
app.queueChannel
.push<ClaimPayload>(CLAIM, { demand: 1 })
.receive('ok', ({ runs }: ClaimReply) => {
const duration = Date.now() - start;
logger.debug(
`claimed ${runs.length} runs: `,
runs.map((r) => r.id).join(',')
`claimed ${runs.length} runs in ${duration}ms (${
runs.length ?
runs.map((r) => r.id).join(',')
: '-'
})`,
);
// TODO what if we get here after we've been cancelled?
// the events have already been claimed...
Expand Down

0 comments on commit 75c6529

Please sign in to comment.