Skip to content

Commit

Permalink
Retry interface implementation must exactly match (Azure#142)
Browse files Browse the repository at this point in the history
fixes Azure#141
  • Loading branch information
Christopher Anderson authored Sep 25, 2018
1 parent 259d5a2 commit 7b7afb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/retry/endpointDiscoveryRetryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ export class EndpointDiscoveryRetryPolicy implements IRetryPolicy {
*/
public async shouldRetry(
err: ErrorResponse,
retryContext: RetryContext,
locationEndpoint: string
retryContext?: RetryContext,
locationEndpoint?: string
): Promise<boolean | [boolean, string]> {
if (!err) {
return false;
}

if (!retryContext || !locationEndpoint) {
return false;
}

if (!this.globalEndpointManager.enableEndpointDiscovery) {
return false;
}
Expand Down
6 changes: 5 additions & 1 deletion src/retry/sessionRetryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ export class SessionRetryPolicy implements IRetryPolicy {
* @param {function} callback - The callback function which takes bool argument which specifies whether the request\
* will be retried or not.
*/
public async shouldRetry(err: ErrorResponse, retryContext: RetryContext): Promise<boolean> {
public async shouldRetry(err: ErrorResponse, retryContext?: RetryContext): Promise<boolean> {
if (!err) {
return false;
}

if (!retryContext) {
return false;
}

if (!this.connectionPolicy.EnableEndpointDiscovery) {
return false;
}
Expand Down

0 comments on commit 7b7afb3

Please sign in to comment.