Skip to content

Commit

Permalink
Track empty fetches
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 15, 2024
1 parent 7ad9bc6 commit 9c676c3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions towerDefence/graphile.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const CONCURRENT_JOBS = 10;

const stats = {
fetches: 0,
emptyFetches: 0,
jobsFetched: 0,
jobsReturned: 0,
timeInMode: Object.create(null),
Expand Down Expand Up @@ -49,17 +50,23 @@ const TowerDefenceResultPlugin = {
`\nPool ${event.workerPool.id} released\nFetches=${p(
stats.fetches,
5,
)}|Fetched=${p(stats.jobsFetched, 6)}|Returned=${p(
stats.jobsReturned,
)}(empty=${p(stats.emptyFetches, 5)})|Fetched=${p(
stats.jobsFetched,
6,
)}|TotalDelay=${p(ms(stats.timeInRefetchDelay), 11)}(Aborted=${p(
)}|Returned=${p(stats.jobsReturned, 6)}|TotalDelay=${p(
ms(stats.timeInRefetchDelay),
11,
)}(Aborted=${p(
`${stats.refetchDelaysAborted}/${stats.refetchDelays}`,
9,
)})|${tim()}\n`,
);
});
ctx.events.on("localQueue:getJobs:complete", ({ jobs }) => {
stats.fetches += 1;
if (jobs.length === 0) {
stats.emptyFetches += 1;
}
stats.jobsFetched += jobs.length;
});
ctx.events.on("localQueue:returnJobs", ({ jobs }) => {
Expand Down

0 comments on commit 9c676c3

Please sign in to comment.