Skip to content

Commit ec4698f

Browse files
author
Danny McCormick
authored
Enable retries (#293)
1 parent 4a586f7 commit ec4698f

4 files changed

Lines changed: 70 additions & 65 deletions

File tree

api/WebApi.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,12 @@ export class WebApi {
233233

234234
// TODO: Don't call resource area here? Will cause infinite loop?
235235
public async getLocationsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<locationsm.ILocationsApi> {
236+
let optionsClone: VsoBaseInterfaces.IRequestOptions = Object.assign({}, this.options);
237+
optionsClone.allowRetries = true;
238+
optionsClone.maxRetries = 5;
236239
serverUrl = await serverUrl || this.serverUrl;
237240
handlers = handlers || [this.authHandler];
238-
return new locationsm.LocationsApi(serverUrl, handlers, this.options);
241+
return new locationsm.LocationsApi(serverUrl, handlers, optionsClone);
239242
}
240243

241244
public async getNotificationApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<notificationm.INotificationApi> {

api/interfaces/common/VsoBaseInterfaces.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ export interface IHttpClientResponse {
8585
}
8686

8787
export interface IRequestOptions {
88-
socketTimeout?: number,
89-
ignoreSslError?: boolean,
90-
proxy?: IProxyConfiguration
91-
cert?: ICertConfiguration
88+
socketTimeout?: number;
89+
ignoreSslError?: boolean;
90+
proxy?: IProxyConfiguration;
91+
cert?: ICertConfiguration;
92+
allowRetries?: boolean;
93+
maxRetries?: number;
9294
}
9395

9496
export interface IProxyConfiguration {

package-lock.json

Lines changed: 58 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-devops-node-api",
33
"description": "Node client for Azure DevOps and TFS REST APIs",
4-
"version": "7.1.0",
4+
"version": "7.2.0",
55
"main": "./WebApi.js",
66
"types": "./WebApi.d.ts",
77
"scripts": {
@@ -26,7 +26,7 @@
2626
"dependencies": {
2727
"os": "0.1.1",
2828
"tunnel": "0.0.4",
29-
"typed-rest-client": "1.0.9",
29+
"typed-rest-client": "1.2.0",
3030
"underscore": "1.8.3"
3131
},
3232
"devDependencies": {

0 commit comments

Comments
 (0)