port domainMiddleware

This commit is contained in:
Matteo Pagliazzi
2015-11-15 18:12:55 +01:00
parent 1cd7189119
commit 5dc2fb0b6f
2 changed files with 18 additions and 0 deletions

View 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,
});
}