slonik
Advanced tools
Comparing version 41.0.0 to 41.0.1
@@ -84,2 +84,5 @@ "use strict"; | ||
} | ||
if (releasePromise) { | ||
await releasePromise; | ||
} | ||
isDestroyed = true; | ||
@@ -86,0 +89,0 @@ clientEventEmitter.emit('destroy'); |
@@ -227,2 +227,16 @@ "use strict"; | ||
}); | ||
test('simultaneous releasing and destroying waits for release promise to resolve before proceeding to terminate the backend', async (t) => { | ||
await t.notThrowsAsync(async () => { | ||
let repeat = 10; | ||
while (repeat--) { | ||
const pool = await (0, __1.createPool)(t.context.dsn, { | ||
driverFactory, | ||
}); | ||
void t.notThrowsAsync(pool.connect((connection) => { | ||
return connection.query(__1.sql.unsafe `SELECT 1`); | ||
})); | ||
await pool.end(); | ||
} | ||
}); | ||
}); | ||
test('does not allow to reuse released connection', async (t) => { | ||
@@ -229,0 +243,0 @@ const pool = await (0, __1.createPool)(t.context.dsn, { |
@@ -95,3 +95,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "41.0.0" | ||
"version": "41.0.1" | ||
} |
@@ -225,2 +225,6 @@ import { Logger } from '../Logger'; | ||
if (releasePromise) { | ||
await releasePromise; | ||
} | ||
isDestroyed = true; | ||
@@ -227,0 +231,0 @@ |
@@ -289,2 +289,22 @@ /* eslint-disable id-length */ | ||
test('simultaneous releasing and destroying waits for release promise to resolve before proceeding to terminate the backend', async (t) => { | ||
await t.notThrowsAsync(async () => { | ||
let repeat = 10; | ||
while (repeat--) { | ||
const pool = await createPool(t.context.dsn, { | ||
driverFactory, | ||
}); | ||
void t.notThrowsAsync( | ||
pool.connect((connection) => { | ||
return connection.query(sql.unsafe`SELECT 1`); | ||
}), | ||
); | ||
await pool.end(); | ||
} | ||
}); | ||
}); | ||
test('does not allow to reuse released connection', async (t) => { | ||
@@ -291,0 +311,0 @@ const pool = await createPool(t.context.dsn, { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1055640
18839