houshengbo commented on a change in pull request #46: Add retry support to 
every request
URL: 
https://github.com/apache/incubator-openwhisk-client-go/pull/46#discussion_r154227467
 
 

 ##########
 File path: whisk/client.go
 ##########
 @@ -316,98 +319,118 @@ func BodyTruncator(body io.ReadCloser) (string, 
io.ReadCloser, error) {
     return string(data), reload, nil
 }
 
+func retry(attempts int, sleep time.Duration, callback func() (*http.Response, 
error)) (*http.Response, error)  {
+    var err error
+    var resp *http.Response
+    for i := 0; ; i++ {
+        resp, err = callback()
 
 Review comment:
   What about checking both of the "code 409" and error message "Concurrent 
modification to resource detected"? Can this be limited to the case of 
Concurrent modification only?
   
   The case of resource competition will happen to any client accessing 
openwhisk, not limited to tests, if multiplerequests are sent to openwhisk in a 
very short interval.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to