mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
port domainMiddleware
This commit is contained in:
16
website/src/middlewares/api-v3/domain.js
Normal file
16
website/src/middlewares/api-v3/domain.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// TODO in api-v2 this module also checked memory usage every x minutes and
|
||||
// threw an error in case of low memory avalible (possible memory leak)
|
||||
// it's yet to be decided whether to keep it or not
|
||||
import domainMiddleware from 'domain-middleware';
|
||||
|
||||
export default function implementDomainMiddleware (server, mongoose) {
|
||||
return domainMiddleware({
|
||||
server: {
|
||||
close () {
|
||||
server.close();
|
||||
mongoose.connection.close();
|
||||
},
|
||||
},
|
||||
killTimeout: 10000,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user