Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-27 Thread Ignasi Barrera
Squashed and merged to 
[master](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/70dba8eb) 
and 
[1.9.x](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/917c06ee). 
Thanks for the feedback @ccustine!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#issuecomment-151667373

Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-27 Thread Ignasi Barrera
Closed #212.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#event-447408816

Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-27 Thread Ignasi Barrera
I've just added a `DigitalOcean2RateLimitExceededException` that extends the 
default one and provides detailed information about the rate limits. This will 
allow users to be able to deal with the rate limit manually, even if the rate 
limit module is not installed.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#issuecomment-151662608

Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-25 Thread Chris Custine
@nacx This is a great addition and this is quality code. I haven't had time to 
test but the code looks great and this should be highly useful for DO users.  
Thanks for doing this.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#issuecomment-151024684

Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-22 Thread Ignasi Barrera
Snapshots should be in place now. Rebuild please!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#issuecomment-150137934

Re: [jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-22 Thread Ignasi Barrera
Snapshots should be in place now: rebuild please!


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212#issuecomment-150137986

[jclouds-labs] JCLOUDS-1022: Automatically handle DigitalOcean rate limit (#212)

2015-10-21 Thread Ignasi Barrera
https://issues.apache.org/jira/browse/JCLOUDS-1022

This pull request introduces a retry handler to deal with the [DigitalOcean 
rate limit](https://developers.digitalocean.com/documentation/v2/#rate-limit). 
The retry handler will read the rate limit information provided in the response 
to determine the amount of time the request has to be delayed. It will block 
the execution thread that amount of time, to finally return `true` so the 
command executor executing the request will retry it.

It is basically the same retry mechanism that is used to follow redirects, but 
introducing an active wait *before* returning if the request has to be retried 
or not. This allows us to apply this directly in the http layer, making it 
transparent to all the code and request execution.

The rate limit is disabled by default, and rate limit failures will be 
propagated as `RateLimitExceededExceptions` (note this PR depends on 
https://github.com/jclouds/jclouds/pull/867 and the build may fail until the 
latest snapshots are published). To use the rate limit features users will just 
have to include the `DigitalOcean2rateLimitModule` when creating the context.

The `jclouds.max-retries` and the `jclouds.jclouds.max-ratelimit-wait` can be 
used to customize the number of retries and the maximum acceptable time to wait 
for a rate limited request,

/cc @ccustine Feedback is very welcome!
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * JCLOUDS-1022: Automatically handle DigitalOcean rate limit

-- File Changes --

A 
digitalocean2/src/main/java/org/jclouds/digitalocean2/config/DigitalOcean2Properties.java
 (33)
A 
digitalocean2/src/main/java/org/jclouds/digitalocean2/config/DigitalOcean2RateLimitModule.java
 (30)
M 
digitalocean2/src/main/java/org/jclouds/digitalocean2/handlers/DigitalOcean2ErrorHandler.java
 (23)
A 
digitalocean2/src/main/java/org/jclouds/digitalocean2/handlers/RateLimitRetryHandler.java
 (108)
M 
digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceLiveTest.java
 (8)
A 
digitalocean2/src/test/java/org/jclouds/digitalocean2/handlers/RateLimitRetryHandlerTest.java
 (153)
M 
digitalocean2/src/test/java/org/jclouds/digitalocean2/internal/BaseDigitalOcean2ApiLiveTest.java
 (7)

-- Patch Links --

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

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/212