glebdmitriew / node-unzip-2

node.js cross-platform unzip using streams
MIT License
44 stars 39 forks source link

unzip.Extract causes the cpu to rise and never decreases. #36

Open liangzhuang327 opened 4 years ago

liangzhuang327 commented 4 years ago

use unzip.Extract, Cpu soars from 4% to 50% and does not recover.

The feature I used in the electron program, removing unzip.Extract cpu will steadily decrease, plus this sentence will rise and not decrease. image

The task in Parse.prototype._flush has been triggered, causing the cpu to remain busy.

`this._pullStream.once("end", function () { self._streamEnd = true; }); this._pullStream.once("finish", function () { self._streamFinish = true; });

Parse.prototype._flush = function (callback) { if (!this._streamEnd || !this._streamFinish) { return setImmediate(this._flush.bind(this, callback)); }

var r = callback(); this.emit('close'); return r; };`

Following the example in README.md, I found that the event registered above was not triggered, causing theParse.prototype._flush to be called again. It ends up with a cpu busyness.

Is it wrong for me to deal with it?

liangzhuang327 commented 4 years ago

solution : replacement