-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
While using node-volapi I noticed that it takes a while for the node process to terminate. I tracked it down to the following lines in sendClose. It appears that the timer from deadline is still in node's task queue.
const send = promisify(this.eio.send.bind(this.eio));
await Promise.race([
deadline(10 * 1000),
send(call, null)
]);While playing around, I replaced those lines with these and it appeared to fix it. I didn't make an MR since this appears to be a pretty common error throughout and I don't know how you want your abstractions.
await new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
done(new VolaError("Disconnect timeout"), null);
}, 10 * 1000);
this.eio.send(call, null, done);
function done(err, data) {
clearTimeout(timeout);
if (err) return reject(err);
resolve(data);
}
});Metadata
Metadata
Assignees
Labels
No labels