Skip to content

Commit 10cb095

Browse files
committed
Improve latency test efficiency
1 parent 9965920 commit 10cb095

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

perfTest/latencyTest.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,20 @@ main().catch((e) => {
9393
async function forEmptyQueue(pgPool) {
9494
let remaining;
9595
do {
96+
await sleep(2000);
9697
const {
9798
rows: [row],
9899
} = await pgPool.query(
99100
`\
100-
select count(*)
101-
from graphile_worker._private_jobs as jobs
102-
where task_id = (
103-
select id from graphile_worker._private_tasks as tasks
104-
where identifier = 'latency'
101+
select exists(
102+
select 1
103+
from graphile_worker._private_jobs as jobs
104+
where task_id = (
105+
select id from graphile_worker._private_tasks as tasks
106+
where identifier = 'latency'
107+
)
105108
)`,
106109
);
107-
remaining = (row && row.count) || 0;
108-
await sleep(2000);
109-
} while (remaining > 0);
110+
remaining = row.exists;
111+
} while (remaining);
110112
}

0 commit comments

Comments
 (0)