bahir-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emlaver <...@git.apache.org>
Subject [GitHub] bahir pull request #49: BAHIR-130
Date Thu, 24 Aug 2017 15:01:23 GMT
Github user emlaver commented on a diff in the pull request:

    https://github.com/apache/bahir/pull/49#discussion_r135040382
  
    --- Diff: sql-cloudant/src/main/scala/org/apache/bahir/cloudant/common/JsonStoreDataAccess.scala
---
    @@ -125,6 +125,19 @@ class JsonStoreDataAccess (config: CloudantConfig)  {
         val clRequest: HttpRequest = getClRequest(url, postData)
     
         val clResponse: HttpResponse[String] = clRequest.execute()
    +          
    +    //BAHIR-130 start
    +    //In cloudant Lite number of requests pre second are limited.
    +    //Just wait and try again
    +    clResponse.code match {
    +        case 429 => {
    +            Thread sleep 1000
    --- End diff --
    
    For each retry we should consider increasing the sleep 'backoff' time.  Use something
like `long sleepTime = initialSleep * Math.round(Math.pow(2, attempt))` to double the sleep
time based on the number of retry attempts.  Our other libraries start with an initial sleep
time of 250 ms.  Here's the [retry method](https://github.com/cloudant/java-cloudant/blob/515cf156751cd67d714a206d1bc39a5489f8c156/cloudant-http/src/main/java/com/cloudant/http/interceptors/Replay429Interceptor.java#L83.)
in our java library that may be helpful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message