-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix - stop promisifying Job#promise and Operation#promise #1732
Conversation
If you add a catch block to both promises, I wonder if it would error out. |
I think I might have figured it out. I think the |
That was it! Some kind of crazy promise inception. I'll update my PR to fix it. |
@jmdobry good catch - an easier fix would probably just be to ignore methods called |
Done |
Edit: added a commit. |
.then(function(results) { | ||
var metadata = results[0]; | ||
assert(metadata.status); | ||
assert.equal(metadata.status.state, 'DONE'); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
}) | ||
.then(function(results) { | ||
var metadata = results[0]; | ||
assert(metadata.status); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return table.import(file) | ||
.then(function(results) { | ||
return results[0].promise(); | ||
}) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
LGTM |
Thanks for catching this and the fix, @jmdobry! We're planning a release today. |
This PR represents a test case allowing one to reproduce a bizarre bug I encountered when trying to use
job.promise()
.Checkout my branch and do the following:
cd packages/bigquery
npm run system-test
The test will start, and the BigQuery import job will be created, and then the process will be killed inexplicably, with nothing else being printed to the console. I tested this in Node v4.2.0 and v6.7.0.
I believe that somehow, when the job attempts to resolve its promise after emitting the "complete" event, the process crashes. I dunno why.
EDIT: This was caused by the
Job#promise
andOperation#promise
methods getting promisified.