You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrew Gaul <no...@github.com> on 2016/06/18 18:13:51 UTC

[jclouds/jclouds-labs] JCLOUDS-1005: Retry on 500 and 503 errors (#289)

This requires rewriting the URL for `b2_upload_file` and `b2_upload_part`
requests.
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/289

-- Commit Summary --

  * JCLOUDS-1005: Retry on 500 and 503 errors

-- File Changes --

    M b2/src/main/java/org/jclouds/b2/B2ApiMetadata.java (2)
    M b2/src/main/java/org/jclouds/b2/config/B2HttpApiModule.java (7)
    A b2/src/main/java/org/jclouds/b2/filters/B2RetryHandler.java (94)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/289.patch
https://github.com/jclouds/jclouds-labs/pull/289.diff

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/289

Re: [jclouds/jclouds-labs] JCLOUDS-1005: Retry on 500 and 503 errors (#289)

Posted by Andrew Gaul <no...@github.com>.
> +      } else if (path.startsWith("/b2api/v1/b2_upload_part")) {
> +         String fileId = path.split("/")[4];
> +         GetUploadPartResponse uploadUrl = api.getMultipartApi().getUploadPartUrl(fileId);
> +         builder.endpoint(uploadUrl.uploadUrl())
> +               .replaceHeader(HttpHeaders.AUTHORIZATION, uploadUrl.authorizationToken());
> +      }
> +
> +      return builder.build();
> +   }
> +
> +   @Override
> +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
> +      boolean retry = false;
> +      try {
> +         byte[] data = closeClientButKeepContentStream(response);
> +         String message = data != null ? new String(data) : null;

Done.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/289/files/ab79bb9fec33595f5f61ca84d2acccd01299e8cf#r67980488

Re: [jclouds/jclouds-labs] JCLOUDS-1005: Retry on 500 and 503 errors (#289)

Posted by Ignasi Barrera <no...@github.com>.
> +      } else if (path.startsWith("/b2api/v1/b2_upload_part")) {
> +         String fileId = path.split("/")[4];
> +         GetUploadPartResponse uploadUrl = api.getMultipartApi().getUploadPartUrl(fileId);
> +         builder.endpoint(uploadUrl.uploadUrl())
> +               .replaceHeader(HttpHeaders.AUTHORIZATION, uploadUrl.authorizationToken());
> +      }
> +
> +      return builder.build();
> +   }
> +
> +   @Override
> +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
> +      boolean retry = false;
> +      try {
> +         byte[] data = closeClientButKeepContentStream(response);
> +         String message = data != null ? new String(data) : null;

Message seems to be unused. Remove this line?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/289/files/ab79bb9fec33595f5f61ca84d2acccd01299e8cf#r67957525

Re: [jclouds/jclouds-labs] JCLOUDS-1005: Retry on 500 and 503 errors (#289)

Posted by Andrew Gaul <no...@github.com>.
This reference explains retries:

https://www.backblaze.com/b2/docs/integration_checklist.html

A follow-on commit will reuse the authorization token as suggested.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/289#issuecomment-226957188

Re: [jclouds/jclouds-labs] JCLOUDS-1005: Retry on 500 and 503 errors (#289)

Posted by Ignasi Barrera <no...@github.com>.
Just one small comment. LGTM!

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/289#issuecomment-227581375