File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,8 @@ export const RETRYABLE_ERR_FN_DEFAULT = function (err?: ApiError) {
270
270
reason . includes ( 'eai_again' ) || // DNS lookup error
271
271
reason === 'econnreset' ||
272
272
reason === 'unexpected connection closure' ||
273
- reason === 'epipe'
273
+ reason === 'epipe' ||
274
+ reason === 'socket connection timeout'
274
275
) ;
275
276
} ;
276
277
Original file line number Diff line number Diff line change @@ -323,6 +323,24 @@ describe('Storage', () => {
323
323
assert . strictEqual ( calledWith . retryOptions . retryableErrorFn ( error ) , true ) ;
324
324
} ) ;
325
325
326
+ it ( 'should retry a socket connection timeout' , ( ) => {
327
+ const storage = new Storage ( {
328
+ projectId : PROJECT_ID ,
329
+ } ) ;
330
+ const calledWith = storage . calledWith_ [ 0 ] ;
331
+ const error = new ApiError ( 'Broken pipe' ) ;
332
+ const innerError = {
333
+ /**
334
+ * @link https://nodejs.org/api/errors.html#err_socket_connection_timeout
335
+ * @link https://github.com/nodejs/node/blob/798db3c92a9b9c9f991eed59ce91e9974c052bc9/lib/internal/errors.js#L1570-L1571
336
+ */
337
+ reason : 'Socket connection timeout' ,
338
+ } ;
339
+
340
+ error . errors = [ innerError ] ;
341
+ assert . strictEqual ( calledWith . retryOptions . retryableErrorFn ( error ) , true ) ;
342
+ } ) ;
343
+
326
344
it ( 'should not retry a 999 error' , ( ) => {
327
345
const storage = new Storage ( {
328
346
projectId : PROJECT_ID ,
You can’t perform that action at this time.
0 commit comments