-
Notifications
You must be signed in to change notification settings - Fork 80
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
Upgrade node v14 to v16 #7081
Upgrade node v14 to v16 #7081
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14.18.2 | ||
16.14.0 |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -59,7 +59,8 @@ class ChunkFS extends stream.Transform { | |||||||
} | ||||||||
|
||||||||
async _flush(callback) { | ||||||||
this._flush_buffers(callback); | ||||||||
// wait before the last writev to finish | ||||||||
await this._flush_buffers(callback); | ||||||||
Comment on lines
+62
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @Utkarsh-pro
Line 1323 in 7a31c5d
noobaa-core/src/util/postgres_client.js Line 1466 in db1bc28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @guymguym, actually that's true but for recent node versions. In node v16, although undocumented, it does calls Here's my understanding code, please correct me if this is wrong:
And that's how I think we exit the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is a sample which won't work in node v16.14.0 (but would in recent and in v14): const util = require("util");
const timeout = util.promisify(setTimeout);
const crypto = require("crypto");
const { Readable, Transform, pipeline, finished } = require("stream");
const pipelineAsync = util.promisify(pipeline);
const finishedAsync = util.promisify(finished);
async function P(...streams) {
return pipelineAsync(...streams).then(() => {
streams[streams.length - 1].resume();
});
}
class TargetHash {
constructor() {
this.hash = crypto.createHash("md5");
}
digest() {
return this.hash.digest("hex");
}
async writev(_config, buffers) {
await timeout(500);
for (const buf of buffers) this.hash.update(buf);
}
}
class T extends Transform {
constructor({ targetHash }) {
super();
this.th = targetHash;
}
async _transform(chunk, encoding, callback) {
await this.th.writev({}, [chunk]);
callback();
}
async _flush(callback) {
console.log("flush start");
this._flush_work(callback);
console.log("flush end");
}
async _flush_work(cb) {
console.log("flush_work start");
await this.th.writev({}, [Buffer.from("EOF")]);
console.log("flush_work end");
console.log("flush_work cb start");
const res = cb();
console.log("flush_work cb end");
return res;
}
}
async function main() {
const th = new TargetHash();
const t = new T(
{ targetHash: th },
);
const r = Readable.from(
(async function* () {
for (let i = 0; i < 1e1; i++) {
yield i.toString();
}
})()
);
console.log("pipeline start");
await P(r, t);
await finishedAsync(t);
console.log("DIGEST:", th.digest());
console.log("pipeline finished");
}
main(); |
||||||||
} | ||||||||
|
||||||||
// callback will be passed only at the end of the stream by _flush() | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Utkarsh-pro Did you consider setting it in the NODE_OPTIONS env instead of adding to all calls?
See https://nodejs.org/docs/latest-v16.x/api/cli.html#node_optionsoptions
But if we are going to clean up these warnings soon, as we should, then it doesn't matter anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guymguym, actually I did open up an issue for cleaning this up here: #7083. But as I mentioned in the issue, I think we would need a tiny bit more help from the runtime as right now it doesn't event shows that the
uncaughtException
was rooted fromunhandledRejection
and has no traces of it in the stack trace either. That's why resorted to this.I think I completely missed considering the
node options
though, thank you!