@adaptivestone/framework 3.0.3 → 3.0.4
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/CHANGELOG.md
CHANGED
package/Cli.js
CHANGED
package/modules/AbstractModel.js
CHANGED
|
@@ -23,7 +23,7 @@ class AbstractModel extends Base {
|
|
|
23
23
|
mongoose.connect(this.app.getConfig('mongo').connectionString, {}).then(
|
|
24
24
|
() => {
|
|
25
25
|
this.logger.info('Mongo connection success');
|
|
26
|
-
this.app.events.on('
|
|
26
|
+
this.app.events.on('shutdown', async () => {
|
|
27
27
|
for (const c of mongoose.connections) {
|
|
28
28
|
c.close(true);
|
|
29
29
|
}
|
package/package.json
CHANGED
package/services/cache/Cache.js
CHANGED
|
@@ -17,6 +17,9 @@ class Cache extends Base {
|
|
|
17
17
|
this.redisClient.on('connect', () => {
|
|
18
18
|
this.logger.info('Redis connection success');
|
|
19
19
|
});
|
|
20
|
+
this.app.events.on('shutdown', () => {
|
|
21
|
+
this.redisClient.quit();
|
|
22
|
+
});
|
|
20
23
|
this.redisGetAsync = promisify(this.redisClient.get).bind(this.redisClient);
|
|
21
24
|
this.promiseMapping = new Map();
|
|
22
25
|
}
|
|
@@ -55,6 +55,10 @@ class RateLimiter extends AbstractMiddleware {
|
|
|
55
55
|
this.logger.info('Redis connection success');
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
this.app.events.on('shutdown', () => {
|
|
59
|
+
redisClient.quit();
|
|
60
|
+
});
|
|
61
|
+
|
|
58
62
|
return new RateLimiterRedis({
|
|
59
63
|
storeClient: redisClient,
|
|
60
64
|
...this.finalOptions.limiterOptions,
|
package/tests/setup.js
CHANGED
|
@@ -64,7 +64,8 @@ beforeAll(async () => {
|
|
|
64
64
|
});
|
|
65
65
|
afterAll(async () => {
|
|
66
66
|
if (global.server) {
|
|
67
|
-
global.server.app.httpServer.
|
|
67
|
+
global.server.app.httpServer.shutdown();
|
|
68
|
+
global.server.app.events.emit('shutdown');
|
|
68
69
|
}
|
|
69
70
|
setTimeout(async () => {
|
|
70
71
|
if (typeof global.testSetup.afterAll === 'function') {
|