Permalink
Browse files

fix(server): ensure to close stream when res is closed

  • Loading branch information...
mycoboco committed Aug 28, 2018
1 parent 0ae01cb commit cfca04eeb1a58dcb8f2bd27fc611ea386aa332de
Showing with 4 additions and 0 deletions.
  1. +2 −0 server/lib/db.mongo.js
  2. +2 −0 server/lib/db.ne.js
View
@@ -244,6 +244,8 @@ function cacheRead(name, metas, to, cb) {
log.info('reading cache for '+name)
rs.on('error', cb)
to.on('error', function () { rs.close() })
.on('close', function () { rs.close() })
rs.pipe(to)
}
View
@@ -190,6 +190,8 @@ function cacheRead(name, metas, to, cb) {
log.info('reading cache for '+name)
rs.on('error', cb)
to.on('error', function () { rs.close() })
.on('close', function () { rs.close() })
rs.pipe(to)
}

0 comments on commit cfca04e

Please sign in to comment.