relq 1.0.122 → 1.0.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,13 @@ class PgBase extends relq_base_1.RelqBase {
130
130
  async _query(sql) {
131
131
  const executeQuery = async () => {
132
132
  if (this.pool) {
133
- return await this.pool.query(sql);
133
+ const client = await this.pool.connect();
134
+ try {
135
+ return await client.query(sql);
136
+ }
137
+ finally {
138
+ client.release();
139
+ }
134
140
  }
135
141
  else if (this.client) {
136
142
  await this.ensureClientConnection();
@@ -15,6 +15,11 @@ function registerGlobalCleanupHandlers() {
15
15
  return;
16
16
  if (typeof node_process_1.default === 'undefined' || !node_process_1.default.on)
17
17
  return;
18
+ try {
19
+ if (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers')
20
+ return;
21
+ }
22
+ catch { }
18
23
  node_process_1.default.on('beforeExit', async () => {
19
24
  if (exports.activeInstances.size === 0)
20
25
  return;
@@ -93,7 +93,13 @@ export class PgBase extends RelqBase {
93
93
  async _query(sql) {
94
94
  const executeQuery = async () => {
95
95
  if (this.pool) {
96
- return await this.pool.query(sql);
96
+ const client = await this.pool.connect();
97
+ try {
98
+ return await client.query(sql);
99
+ }
100
+ finally {
101
+ client.release();
102
+ }
97
103
  }
98
104
  else if (this.client) {
99
105
  await this.ensureClientConnection();
@@ -6,6 +6,11 @@ export function registerGlobalCleanupHandlers() {
6
6
  return;
7
7
  if (typeof process === 'undefined' || !process.on)
8
8
  return;
9
+ try {
10
+ if (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers')
11
+ return;
12
+ }
13
+ catch { }
9
14
  process.on('beforeExit', async () => {
10
15
  if (activeInstances.size === 0)
11
16
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",