We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 906fb27 commit e7a45ceCopy full SHA for e7a45ce
src/Adapters/Storage/Mongo/MongoStorageAdapter.js
@@ -97,6 +97,17 @@ export class MongoStorageAdapter {
97
98
// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
99
this._maxTimeMS = mongoOptions.maxTimeMS;
100
+ process.on('SIGTERM', this.handleShutdown(this));
101
+ process.on('SIGINT', this.handleShutdown(this));
102
+ }
103
+
104
+ handleShutdown(storageAdapter) {
105
+ return () => {
106
+ if (!storageAdapter.database) {
107
+ return;
108
109
+ storageAdapter.database.close(false);
110
111
}
112
113
connect() {
0 commit comments