Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: zlib deflate concurrency limit #1204

Merged
merged 1 commit into from Sep 13, 2017

Conversation

STRML
Copy link
Contributor

@STRML STRML commented Sep 11, 2017

Ref: #1202

Built on top of async-limiter which is only 1kB of dependency-free ES5.

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, only style nits. Other than that LGTM.

@@ -4,12 +4,21 @@ const safeBuffer = require('safe-buffer');
const zlib = require('zlib');

const bufferUtil = require('./BufferUtil');
const Limiter = require('async-limiter');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this to the above block?

*
* @param {Buffer} data Compressed data
* @param {Boolean} fin Specifies whether or not this is the last fragment
* @param {Function} callback Callback
* @public
*/
decompress (data, fin, callback) {
zlibLimiter.push((done) => {
this._decompress(data, fin, function (err, result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind to use arrow functions for consistency?

*/
compress (data, fin, callback) {
zlibLimiter.push((done) => {
this._compress(data, fin, function (err, result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

package.json Outdated
@@ -26,6 +26,7 @@
"lint": "eslint ."
},
"dependencies": {
"async-limiter": "^1.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use the same versioning scheme?

@STRML
Copy link
Contributor Author

STRML commented Sep 11, 2017

Great - fixed nits.

@lpinca lpinca merged commit f2d18b6 into websockets:master Sep 13, 2017
@lpinca
Copy link
Member

lpinca commented Sep 13, 2017

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants