@adaptivestone/framework 4.8.2 → 4.8.3
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 +4 -0
- package/models/Migration.test.js +1 -0
- package/modules/AbstractModel.js +7 -6
- package/package.json +1 -1
- package/tests/setup.js +2 -0
- package/tests/setupVitest.js +2 -0
package/CHANGELOG.md
CHANGED
package/models/Migration.test.js
CHANGED
package/modules/AbstractModel.js
CHANGED
|
@@ -21,16 +21,17 @@ class AbstractModel extends Base {
|
|
|
21
21
|
this.mongooseSchema,
|
|
22
22
|
);
|
|
23
23
|
if (!mongoose.connection.readyState) {
|
|
24
|
+
this.app.events.on('shutdown', async () => {
|
|
25
|
+
for (const c of mongoose.connections) {
|
|
26
|
+
c.close(true);
|
|
27
|
+
}
|
|
28
|
+
// await mongoose.disconnect(); // TODO it have problems with replica-set
|
|
29
|
+
});
|
|
24
30
|
// do not connect on test
|
|
25
31
|
mongoose.connect(this.app.getConfig('mongo').connectionString, {}).then(
|
|
26
32
|
() => {
|
|
27
33
|
this.logger.info('Mongo connection success');
|
|
28
|
-
|
|
29
|
-
for (const c of mongoose.connections) {
|
|
30
|
-
c.close(true);
|
|
31
|
-
}
|
|
32
|
-
// await mongoose.disconnect(); // TODO it have problems with replica-set
|
|
33
|
-
});
|
|
34
|
+
|
|
34
35
|
callback();
|
|
35
36
|
},
|
|
36
37
|
(error) => {
|
package/package.json
CHANGED
package/tests/setup.js
CHANGED
package/tests/setupVitest.js
CHANGED