Skip to content

Commit 97ff445

Browse files
authored
Add missing await to latency test script (#574)
2 parents 91c950f + 14bdaaa commit 97ff445

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
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-
sleep(2000);
109-
} while (remaining > 0);
110+
remaining = row.exists;
111+
} while (remaining);
110112
}

scripts/dump_db

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dropuser graphile_worker_role || true
66
psql template1 -c "CREATE USER graphile_worker_role WITH SUPERUSER PASSWORD 'password';"
77
createdb graphile_worker_dump -O graphile_worker_role
88
PGUSER=graphile_worker_role PGPASSWORD=password PGHOST=127.0.0.1 ts-node src/cli.ts -c postgres:///graphile_worker_dump --schema-only
9-
pg_dump --schema-only --no-owner graphile_worker_dump | sed -E -e '/^--/d' -e '/^\s*$/d' -e '/^SET /d' -e 's/EXECUTE FUNCTION/EXECUTE PROCEDURE/g' -e '/^(REVOKE|GRANT) .* ON SCHEMA public (FROM|TO) PUBLIC;$/d' > __tests__/schema.sql
10-
pg_dump --data-only --no-owner graphile_worker_dump --table=graphile_worker.migrations --table=graphile_worker._private_pro_migrations | sed -E -e '/^--/d' -e '/^\s*$/d' -e 's/\b2[0-9]{3}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{1,6}\+[0-9]+/1970-01-01 00:00:00.000000+00/g' -e '/^SET /d' >> __tests__/schema.sql
9+
pg_dump --schema-only --no-owner graphile_worker_dump | sed -E -e '/^--/d' -e '/^\s*$/d' -e '/^[\\](un)?restrict/d' -e '/^SET /d' -e 's/EXECUTE FUNCTION/EXECUTE PROCEDURE/g' -e '/^(REVOKE|GRANT) .* ON SCHEMA public (FROM|TO) PUBLIC;$/d' > __tests__/schema.sql
10+
pg_dump --data-only --no-owner graphile_worker_dump --table=graphile_worker.migrations --table=graphile_worker._private_pro_migrations | sed -E -e '/^--/d' -e '/^\s*$/d' -e '/^[\\](un)?restrict/d' -e 's/\b2[0-9]{3}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{1,6}\+[0-9]+/1970-01-01 00:00:00.000000+00/g' -e '/^SET /d' >> __tests__/schema.sql
1111
dropdb graphile_worker_dump
1212
dropuser graphile_worker_role

0 commit comments

Comments
 (0)