Fix koa-compress memory leak
This commit is contained in:
parent
fc5dad84f0
commit
7976ec7f8a
1 changed files with 14 additions and 1 deletions
15
app.js
15
app.js
|
@ -21,6 +21,7 @@ import share from './routes/share.js';
|
||||||
import { slack, oauth } from './routes/slack.js';
|
import { slack, oauth } from './routes/slack.js';
|
||||||
import errorHandler from './lib/error-handler.js';
|
import errorHandler from './lib/error-handler.js';
|
||||||
import newrelic from 'newrelic';
|
import newrelic from 'newrelic';
|
||||||
|
import { constants } from 'zlib'
|
||||||
|
|
||||||
const debug = debuglog('combine.fm');
|
const debug = debuglog('combine.fm');
|
||||||
|
|
||||||
|
@ -55,7 +56,19 @@ app.use(errorHandler(Sentry));
|
||||||
|
|
||||||
app.use(bodyparser());
|
app.use(bodyparser());
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(compress({ flush: zlib.Z_SYNC_FLUSH }));
|
app.use(compress({
|
||||||
|
filter (content_type) {
|
||||||
|
return /text/i.test(content_type)
|
||||||
|
},
|
||||||
|
threshold: 2048,
|
||||||
|
gzip: {
|
||||||
|
flush: constants.Z_SYNC_FLUSH
|
||||||
|
},
|
||||||
|
deflate: {
|
||||||
|
flush: constants.Z_SYNC_FLUSH,
|
||||||
|
},
|
||||||
|
br: false
|
||||||
|
}));
|
||||||
app.use(favicon(path.join(__dirname, '/public/assets/images/favicon.png')));
|
app.use(favicon(path.join(__dirname, '/public/assets/images/favicon.png')));
|
||||||
app.use(logger());
|
app.use(logger());
|
||||||
app.use(serve('public', { maxage: 31536000000 }));
|
app.use(serve('public', { maxage: 31536000000 }));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue