Repository navigation
feat: emit 'response' with every page - #887
gcf-merge-on-green[bot] merged 4 commits into
Conversation
|
I feel really bad about this, and need to talk to the team about it. |
|
@AVaksman is the general problem here that from Bigtable, we need something in the raw API response, but gax isn't giving it to us in stream mode? Instead of special-casing this property, could we have the gax stream |
Correct, the user has no access to |
|
Would emitting that event on each paginated response work? From Bigtable, we could then use that event to collect the API responses and do whatever it needs. |
👍 And provide a such sample in the |
|
Yes, I totally like the idea of emitting the original API response within each page received from the service. Then the manual layer can do whatever it needs with that data. Thank you for this idea @stephenplusplus! @AVaksman Can you update this PR to do this ^^^, or do you want me to implement it? Should not be hard at all from what I understand. |
|
Will update this PR accordingly. |
|
|
||
| it('emits response event with apiCall', done => { | ||
| const onRespone = sinon.spy(); | ||
| // @ts-ignore incomplete optio |
There was a problem hiding this comment.
| // @ts-ignore incomplete optio | |
| // @ts-ignore incomplete option |
?
| }); | ||
|
|
||
| it('emits response event with apiCall', done => { | ||
| const onRespone = sinon.spy(); |
There was a problem hiding this comment.
| const onRespone = sinon.spy(); | |
| const onResponse = sinon.spy(); |
There was a problem hiding this comment.
Corrected here and below.
| const onRespone = sinon.spy(); | ||
| // @ts-ignore incomplete optio | ||
| const stream = descriptor.createStream(apiCall, {}, null); | ||
| stream.on('response', onRespone); |
There was a problem hiding this comment.
| stream.on('response', onRespone); | |
| stream.on('response', onResponse); |
| stream.on('response', onRespone); | ||
| streamChecker( | ||
| stream, | ||
| () => assert.strictEqual(onRespone.callCount, pagesToStream + 1), |
There was a problem hiding this comment.
| () => assert.strictEqual(onRespone.callCount, pagesToStream + 1), | |
| () => assert.strictEqual(onResponse.callCount, pagesToStream + 1), |
|
The browser test failure is unrelated to this change and can be ignored, I will take care of that separately. |
🤖 I have created a release \*beep\* \*boop\* --- ## [2.8.0](https://www.github.com/googleapis/gax-nodejs/compare/v2.7.0...v2.8.0) (2020-09-02) ### Features * emit 'response' with every page ([#887](https://www.github.com/googleapis/gax-nodejs/issues/887)) ([9c7f983](https://www.github.com/googleapis/gax-nodejs/commit/9c7f98336edd75b6b5ce954b093d449d40def290)), closes [/github.com/googleapis/googleapis/blob/94fe3637559a257634d7b47a15bb8d976daff788/google/bigtable/admin/v2/bigtable_instance_admin.proto#L541](https://www.github.com/googleapis//github.com/googleapis/googleapis/blob/94fe3637559a257634d7b47a15bb8d976daff788/google/bigtable/admin/v2/bigtable_instance_admin.proto/issues/L541) [/github.com/googleapis/gax-nodejs/blob/eb7aa446dabf420d65831cd151b8b3076e087c71/src/paginationCalls/pageDescriptor.ts#L63](https://www.github.com/googleapis//github.com/googleapis/gax-nodejs/blob/eb7aa446dabf420d65831cd151b8b3076e087c71/src/paginationCalls/pageDescriptor.ts/issues/L63) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Bigtable.listAppProfilessupports pagination and may return a unique valuefailedLocations.Currently streamified version of the paginated call does not expose
failedLocationsto user.This PR offers to emit a decorated error explaining that resources from some locations are currently not available.
The error is emitted after all available resources have been
push-ed to stream.