Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch slonik to close streams more reliably #599

Merged
merged 4 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- checkout
- run: make check-file-headers
- run: npm ci
- run: npm ci --legacy-peer-deps
matthew-white marked this conversation as resolved.
Show resolved Hide resolved
- run: node lib/bin/create-docker-databases.js
- run: make test-full

2 changes: 1 addition & 1 deletion .github/workflows/benchmarker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm ci --legacy-peer-deps
- run: node lib/bin/create-docker-databases.js
- name: Benchmark
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
default: base

node_modules: package.json
npm install
npm install --legacy-peer-deps
touch node_modules

.PHONY: node_version
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"prompt": "~1",
"ramda": "~0",
"sanitize-filename": "~1",
"slonik": "23.6.2",
"slonik": "npm:@getodk/slonik@23.6.2-3",
"slonik-sql-tag-raw": "1.0.3",
"tmp-promise": "~3",
"uuid": "~3",
Expand Down
26 changes: 6 additions & 20 deletions test/integration/other/db-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,13 @@ describe('db.stream()', () => {
await clock.tickAsync(60 * 1000);
};

beforeEach(() => { clock = FakeTimers.install({ shouldClearNativeTimers: true }); });
afterEach(() => clock?.uninstall());

// TODO this doesn't seem like the correct behaviour - no Error is thrown
// here. At some point, this should be fixed elsewhere!
it('should close streams given an invalid sql statement', async () => {
// when
const stream = await db.stream(sql`NOT A SQL STATEMENT`);

// then
pool.getPoolState().activeConnectionCount.should.equal(1);
stream.destroyed.should.equal(false);

// when
await oneMinute();
await oneMinute();
// then
pool.getPoolState().activeConnectionCount.should.equal(0);
stream.destroyed.should.equal(true);
beforeEach(() => {
clock = FakeTimers.install({
shouldClearNativeTimers: true,
toFake: ['setTimeout', 'clearTimeout'],
});
});

afterEach(() => clock?.uninstall());

it('should time out after 2 mins if no activity at all', async () => {
// given
Expand Down