Skip to content

Commit 2489c77

Browse files
mohd-akramjonaswalden
authored andcommitted
Address review comments
1 parent a80f156 commit 2489c77

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/channel_model.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,17 @@ class ConfirmChannel extends Channel {
282282
if (err === null) resolve();
283283
else reject(err);
284284
};
285-
if (!this.pending) unconfirmed[index](new Error('channel closed'))
286285
});
287286
awaiting.push(confirmed);
288287
}
289288
});
289+
// Channel closed
290+
if (!this.pending) {
291+
var cb;
292+
while (cb = this.unconfirmed.shift()) {
293+
if (cb) cb(new Error('channel closed'));
294+
}
295+
}
290296
return Promise.all(awaiting);
291297
}
292298
}

test/channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var DELIVER_FIELDS = {
7575
replyText: 'derp',
7676
};
7777

78-
async function open(ch) {
78+
function open(ch) {
7979
ch.allocate();
8080
return promisify(function(cb) {
8181
ch._rpc(defs.ChannelOpen, {outOfBand: ''}, defs.ChannelOpenOk, cb);

0 commit comments

Comments
 (0)