Skip to content

Commit eef9e78

Browse files
committed
fix: remove async from final function which causes double invocation … (googleapis#2094)
* fix: remove async from final function which causes double invocation of callback * add catch clause
1 parent a622290 commit eef9e78

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/file.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,12 +1530,15 @@ class File extends ServiceObject<File> {
15301530
}
15311531

15321532
const handoffStream = new PassThrough({
1533-
final: async cb => {
1533+
final: cb => {
15341534
// Preserving `onComplete`'s ability to
15351535
// destroy `throughStream` before pipeline
15361536
// attempts to.
1537-
await onComplete(null);
1538-
cb();
1537+
onComplete(null)
1538+
.then(() => {
1539+
cb();
1540+
})
1541+
.catch(cb);
15391542
},
15401543
});
15411544

0 commit comments

Comments
 (0)