Skip to content

Commit

Permalink
wait for job result before emitting complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Apr 2, 2018
1 parent f2f7fce commit 1b06d7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,9 @@ Table.prototype.createWriteStream = function(metadata) {
var job = self.bigQuery.job(data.jobReference.jobId);
job.metadata = data;

dup.emit('complete', job);
job
.on('error', err => dup.destroy(err))
.on('complete', () => dup.emit('complete', job));
}
);
});
Expand Down

0 comments on commit 1b06d7c

Please sign in to comment.