pg-cache 3.1.0 → 3.3.2
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.
- package/esm/lru.js +14 -5
- package/lru.js +14 -5
- package/package.json +8 -8
package/esm/lru.js
CHANGED
|
@@ -92,6 +92,9 @@ export class PgPoolCacheManager {
|
|
|
92
92
|
this.closed = true;
|
|
93
93
|
this.clear();
|
|
94
94
|
await this.waitForDisposals();
|
|
95
|
+
// Re-open the cache so it can accept new entries if the process
|
|
96
|
+
// survives the shutdown signal (e.g. during provisioning or restart).
|
|
97
|
+
this.closed = false;
|
|
95
98
|
}
|
|
96
99
|
async waitForDisposals() {
|
|
97
100
|
if (this.cleanupTasks.length === 0)
|
|
@@ -125,11 +128,17 @@ export const close = async (verbose = false) => {
|
|
|
125
128
|
if (closePromise.promise)
|
|
126
129
|
return closePromise.promise;
|
|
127
130
|
closePromise.promise = (async () => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
try {
|
|
132
|
+
if (verbose)
|
|
133
|
+
log.info('Closing pg cache...');
|
|
134
|
+
await pgCache.close();
|
|
135
|
+
if (verbose)
|
|
136
|
+
log.success('PG cache disposed.');
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
// Reset so close() can be called again if the process survives.
|
|
140
|
+
closePromise.promise = null;
|
|
141
|
+
}
|
|
133
142
|
})();
|
|
134
143
|
return closePromise.promise;
|
|
135
144
|
};
|
package/lru.js
CHANGED
|
@@ -95,6 +95,9 @@ class PgPoolCacheManager {
|
|
|
95
95
|
this.closed = true;
|
|
96
96
|
this.clear();
|
|
97
97
|
await this.waitForDisposals();
|
|
98
|
+
// Re-open the cache so it can accept new entries if the process
|
|
99
|
+
// survives the shutdown signal (e.g. during provisioning or restart).
|
|
100
|
+
this.closed = false;
|
|
98
101
|
}
|
|
99
102
|
async waitForDisposals() {
|
|
100
103
|
if (this.cleanupTasks.length === 0)
|
|
@@ -129,11 +132,17 @@ const close = async (verbose = false) => {
|
|
|
129
132
|
if (closePromise.promise)
|
|
130
133
|
return closePromise.promise;
|
|
131
134
|
closePromise.promise = (async () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
try {
|
|
136
|
+
if (verbose)
|
|
137
|
+
log.info('Closing pg cache...');
|
|
138
|
+
await exports.pgCache.close();
|
|
139
|
+
if (verbose)
|
|
140
|
+
log.success('PG cache disposed.');
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
// Reset so close() can be called again if the process survives.
|
|
144
|
+
closePromise.promise = null;
|
|
145
|
+
}
|
|
137
146
|
})();
|
|
138
147
|
return closePromise.promise;
|
|
139
148
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-cache",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostgreSQL connection pool LRU cache manager",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pgpmjs/logger": "^2.2
|
|
33
|
-
"@pgpmjs/types": "^2.
|
|
34
|
-
"lru-cache": "^11.2.
|
|
35
|
-
"pg": "^8.
|
|
36
|
-
"pg-env": "^1.
|
|
32
|
+
"@pgpmjs/logger": "^2.4.2",
|
|
33
|
+
"@pgpmjs/types": "^2.19.2",
|
|
34
|
+
"lru-cache": "^11.2.6",
|
|
35
|
+
"pg": "^8.19.0",
|
|
36
|
+
"pg-env": "^1.7.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/pg": "^8.
|
|
39
|
+
"@types/pg": "^8.18.0",
|
|
40
40
|
"makage": "^0.1.12"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"connection",
|
|
49
49
|
"constructive"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "4fd2c9be786ad9ae2213453276a69723435d5315"
|
|
52
52
|
}
|