Skip to content

Commit

Permalink
fix: remove async from final function which causes double invocation … (
Browse files Browse the repository at this point in the history
#2094)

* fix: remove async from final function which causes double invocation of callback

* add catch clause
  • Loading branch information
ddelgrosso1 committed Oct 25, 2022
1 parent 2145c81 commit 1a3df98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/file.ts
Expand Up @@ -1530,12 +1530,15 @@ class File extends ServiceObject<File> {
}

const handoffStream = new PassThrough({
final: async cb => {
final: cb => {
// Preserving `onComplete`'s ability to
// destroy `throughStream` before pipeline
// attempts to.
await onComplete(null);
cb();
onComplete(null)
.then(() => {
cb();
})
.catch(cb);
},
});

Expand Down

0 comments on commit 1a3df98

Please sign in to comment.