Socket
Socket
Sign inDemoInstall

slonik

Package Overview
Dependencies
Maintainers
1
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slonik - npm Package Compare versions

Comparing version 40.2.4 to 40.2.5

8

dist/factories/createConnectionPool.js

@@ -31,2 +31,10 @@ "use strict";

}
try {
await Promise.all(waitingClients.map((waitingClient) => waitingClient.promise));
}
catch (error) {
logger.error({
error: (0, serialize_error_1.serializeError)(error),
}, 'error in pool termination sequence while waiting for waiting clients to be resolved');
}
// This is needed to ensure that all pending connections were assigned a waiting client.

@@ -33,0 +41,0 @@ // e.g. "waits for all connections to be established before attempting to terminate the pool" test

@@ -1294,2 +1294,24 @@ "use strict";

});
test('waits for every client to be assigned', async (t) => {
const pool = await (0, __1.createPool)(t.context.dsn, {
driverFactory,
maximumPoolSize: 1,
});
const connection1 = pool.connect(async (connection) => {
await connection.query(__1.sql.unsafe `
SELECT pg_sleep(0.1);
`);
return 'connection 1';
});
const connection2 = pool.connect(async (connection) => {
await connection.query(__1.sql.unsafe `
SELECT pg_sleep(0.1);
`);
return 'connection 2';
});
await (0, promises_1.setTimeout)(50);
await t.notThrowsAsync(pool.end());
t.is(await connection1, 'connection 1');
t.is(await connection2, 'connection 2');
});
test('pool.end() resolves only when pool ends', async (t) => {

@@ -1296,0 +1318,0 @@ const pool = await (0, __1.createPool)(t.context.dsn, {

2

package.json

@@ -95,3 +95,3 @@ {

"types": "./dist/index.d.ts",
"version": "40.2.4"
"version": "40.2.5"
}

@@ -91,2 +91,15 @@ import { Logger } from '../Logger';

try {
await Promise.all(
waitingClients.map((waitingClient) => waitingClient.promise),
);
} catch (error) {
logger.error(
{
error: serializeError(error),
},
'error in pool termination sequence while waiting for waiting clients to be resolved',
);
}
// This is needed to ensure that all pending connections were assigned a waiting client.

@@ -93,0 +106,0 @@ // e.g. "waits for all connections to be established before attempting to terminate the pool" test

@@ -1715,2 +1715,32 @@ /* eslint-disable id-length */

test('waits for every client to be assigned', async (t) => {
const pool = await createPool(t.context.dsn, {
driverFactory,
maximumPoolSize: 1,
});
const connection1 = pool.connect(async (connection) => {
await connection.query(sql.unsafe`
SELECT pg_sleep(0.1);
`);
return 'connection 1';
});
const connection2 = pool.connect(async (connection) => {
await connection.query(sql.unsafe`
SELECT pg_sleep(0.1);
`);
return 'connection 2';
});
await delay(50);
await t.notThrowsAsync(pool.end());
t.is(await connection1, 'connection 1');
t.is(await connection2, 'connection 2');
});
test('pool.end() resolves only when pool ends', async (t) => {

@@ -1717,0 +1747,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc