Skip to content

Commit

Permalink
fix: use new gax streaming retries (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster authored Jan 18, 2024
1 parent 45f4989 commit 8da1195
Show file tree
Hide file tree
Showing 30 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class BigQueryStorageClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest')
readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

// Put together the default options sent with requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
request.readPosition.stream.name = defaultValue1;
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.readRows(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.readRows(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class BigQueryStorageClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback)
readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

// Put together the default options sent with requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
request.readPosition.stream.name = defaultValue1;
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.readRows(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.readRows(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, opts.fallback === 'rest'),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos as gax.protobuf.INamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ export class MessagingClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, opts.fallback === 'rest'),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos as gax.protobuf.INamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ describe('v1beta1.MessagingClient', () => {
request.name = defaultValue1;
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.streamBlurbs(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export class MessagingClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ describe('v1beta1.MessagingClient', () => {
request.name = defaultValue1;
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.streamBlurbs(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class LoggingServiceV2Client {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos as gax.protobuf.INamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class LoggingServiceV2Client {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, opts.fallback === 'rest'),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos as gax.protobuf.INamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ export class MessagingClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, opts.fallback === 'rest'),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos as gax.protobuf.INamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ describe('v1beta1.MessagingClient', () => {
request.name = defaultValue1;
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.streamBlurbs(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => {
resolve(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, opts.fallback === 'rest'),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest')
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

let protoFilesRoot = new this._gaxModule.GoogleProtoFilesRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
6 changes: 3 additions & 3 deletions baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

let protoFilesRoot = new this._gaxModule.GoogleProtoFilesRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
6 changes: 3 additions & 3 deletions baselines/showcase/src/v1beta1/echo_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ export class EchoClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
Expand Down
6 changes: 3 additions & 3 deletions baselines/showcase/src/v1beta1/messaging_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ export class MessagingClient {
// Some of the methods on this service provide streaming responses.
// Provide descriptors for these.
this.descriptors.stream = {
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback)
streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true),
connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, /* gaxStreamingRetries: */ true)
};

const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
Expand Down
2 changes: 1 addition & 1 deletion baselines/showcase/test/gapic_echo_v1beta1.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ describe('v1beta1.EchoClient', () => {
);
const expectedError = new Error('The client has already been closed.');
client.close();
const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}});
const stream = client.expand(request, {retry: {shouldRetryFn: () => { return false; }}});
const promise = new Promise((resolve, reject) => {
stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => {
resolve(response);
Expand Down
Loading

0 comments on commit 8da1195

Please sign in to comment.