{"action":"created","comment":{"url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments/78405648","id":78405648,"diff_hunk":"@@ -0,0 +1,102 @@\n+/*\n+ * Copyright 2016 Google, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.netflix.spinnaker.clouddriver.google.deploy\n+\n+import com.google.api.client.googleapis.json.GoogleJsonResponseException\n+import com.google.common.annotations.VisibleForTesting\n+import com.netflix.spinnaker.clouddriver.data.task.Task\n+import com.netflix.spinnaker.clouddriver.google.deploy.exception.GoogleOperationException\n+import groovy.util.logging.Slf4j\n+\n+import java.util.concurrent.TimeUnit\n+\n+@Slf4j\n+class SafeRetry<T> {\n+\n+  @VisibleForTesting\n+  static long SAFE_RETRY_INTERVAL_MILLIS = TimeUnit.SECONDS.toMillis(10)\n+\n+  /**\n+   * Retry a GCP operation if it fails. Treat any error codes in successfulErrorCodes as success.\n+   *\n+   * @param operation - The GCP operation.\n+   * @param action - String describing the GCP operation.\n+   * @param resource - Resource we are operating on.\n+   * @param task - Spinnaker task. Can be null.\n+   * @param phase\n+   * @param retryCodes - GoogleJsonResponseException codes we retry on.\n+   * @param successfulErrorCodes - GoogleJsonException codes we treat as success.\n+   *\n+   * @return Object of type T returned from the operation.\n+   */\n+  public T doRetry(Closure<T> operation,\n+                          String action,","path":"clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/SafeRetry.groovy","position":47,"original_position":47,"commit_id":"8fcf73a8d011e4c46cf607c6397d88922140c4af","original_commit_id":"8fcf73a8d011e4c46cf607c6397d88922140c4af","user":{"login":"duftler","id":8437718,"avatar_url":"https://avatars.githubusercontent.com/u/8437718?v=3","gravatar_id":"","url":"https://api.github.com/users/duftler","html_url":"https://github.com/duftler","followers_url":"https://api.github.com/users/duftler/followers","following_url":"https://api.github.com/users/duftler/following{/other_user}","gists_url":"https://api.github.com/users/duftler/gists{/gist_id}","starred_url":"https://api.github.com/users/duftler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duftler/subscriptions","organizations_url":"https://api.github.com/users/duftler/orgs","repos_url":"https://api.github.com/users/duftler/repos","events_url":"https://api.github.com/users/duftler/events{/privacy}","received_events_url":"https://api.github.com/users/duftler/received_events","type":"User","site_admin":false},"body":"Indentation is off here.","created_at":"2016-09-12T16:26:50Z","updated_at":"2016-09-12T16:26:50Z","html_url":"https://github.com/spinnaker/clouddriver/pull/1013#discussion_r78405648","pull_request_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013","_links":{"self":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments/78405648"},"html":{"href":"https://github.com/spinnaker/clouddriver/pull/1013#discussion_r78405648"},"pull_request":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013"}}},"pull_request":{"url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013","id":84886442,"html_url":"https://github.com/spinnaker/clouddriver/pull/1013","diff_url":"https://github.com/spinnaker/clouddriver/pull/1013.diff","patch_url":"https://github.com/spinnaker/clouddriver/pull/1013.patch","issue_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/1013","number":1013,"state":"open","locked":false,"title":"provider/google: Refactor safeRetry and handle socket timeout.","user":{"login":"jtk54","id":5456773,"avatar_url":"https://avatars.githubusercontent.com/u/5456773?v=3","gravatar_id":"","url":"https://api.github.com/users/jtk54","html_url":"https://github.com/jtk54","followers_url":"https://api.github.com/users/jtk54/followers","following_url":"https://api.github.com/users/jtk54/following{/other_user}","gists_url":"https://api.github.com/users/jtk54/gists{/gist_id}","starred_url":"https://api.github.com/users/jtk54/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtk54/subscriptions","organizations_url":"https://api.github.com/users/jtk54/orgs","repos_url":"https://api.github.com/users/jtk54/repos","events_url":"https://api.github.com/users/jtk54/events{/privacy}","received_events_url":"https://api.github.com/users/jtk54/received_events","type":"User","site_admin":false},"body":"@duftler @lwander please review. Refactored `safeRetry` into a generic, type-safe class since `getOperation` actually returns something instead of `void`. Added socket timeout handling instead of `GoogleOperationTimedOutException` since the latter is not something the platform throws.","created_at":"2016-09-12T14:56:43Z","updated_at":"2016-09-12T16:26:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fdc18774be14a886ad6d2c0014290895e1b6da7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013/commits","review_comments_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013/comments","review_comment_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/1013/comments","statuses_url":"https://api.github.com/repos/spinnaker/clouddriver/statuses/8fcf73a8d011e4c46cf607c6397d88922140c4af","head":{"label":"jtk54:socket-retry","ref":"socket-retry","sha":"8fcf73a8d011e4c46cf607c6397d88922140c4af","user":{"login":"jtk54","id":5456773,"avatar_url":"https://avatars.githubusercontent.com/u/5456773?v=3","gravatar_id":"","url":"https://api.github.com/users/jtk54","html_url":"https://github.com/jtk54","followers_url":"https://api.github.com/users/jtk54/followers","following_url":"https://api.github.com/users/jtk54/following{/other_user}","gists_url":"https://api.github.com/users/jtk54/gists{/gist_id}","starred_url":"https://api.github.com/users/jtk54/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtk54/subscriptions","organizations_url":"https://api.github.com/users/jtk54/orgs","repos_url":"https://api.github.com/users/jtk54/repos","events_url":"https://api.github.com/users/jtk54/events{/privacy}","received_events_url":"https://api.github.com/users/jtk54/received_events","type":"User","site_admin":false},"repo":{"id":54126367,"name":"clouddriver","full_name":"jtk54/clouddriver","owner":{"login":"jtk54","id":5456773,"avatar_url":"https://avatars.githubusercontent.com/u/5456773?v=3","gravatar_id":"","url":"https://api.github.com/users/jtk54","html_url":"https://github.com/jtk54","followers_url":"https://api.github.com/users/jtk54/followers","following_url":"https://api.github.com/users/jtk54/following{/other_user}","gists_url":"https://api.github.com/users/jtk54/gists{/gist_id}","starred_url":"https://api.github.com/users/jtk54/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtk54/subscriptions","organizations_url":"https://api.github.com/users/jtk54/orgs","repos_url":"https://api.github.com/users/jtk54/repos","events_url":"https://api.github.com/users/jtk54/events{/privacy}","received_events_url":"https://api.github.com/users/jtk54/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jtk54/clouddriver","description":"read and write operations across cloud providers","fork":true,"url":"https://api.github.com/repos/jtk54/clouddriver","forks_url":"https://api.github.com/repos/jtk54/clouddriver/forks","keys_url":"https://api.github.com/repos/jtk54/clouddriver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jtk54/clouddriver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jtk54/clouddriver/teams","hooks_url":"https://api.github.com/repos/jtk54/clouddriver/hooks","issue_events_url":"https://api.github.com/repos/jtk54/clouddriver/issues/events{/number}","events_url":"https://api.github.com/repos/jtk54/clouddriver/events","assignees_url":"https://api.github.com/repos/jtk54/clouddriver/assignees{/user}","branches_url":"https://api.github.com/repos/jtk54/clouddriver/branches{/branch}","tags_url":"https://api.github.com/repos/jtk54/clouddriver/tags","blobs_url":"https://api.github.com/repos/jtk54/clouddriver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jtk54/clouddriver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jtk54/clouddriver/git/refs{/sha}","trees_url":"https://api.github.com/repos/jtk54/clouddriver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jtk54/clouddriver/statuses/{sha}","languages_url":"https://api.github.com/repos/jtk54/clouddriver/languages","stargazers_url":"https://api.github.com/repos/jtk54/clouddriver/stargazers","contributors_url":"https://api.github.com/repos/jtk54/clouddriver/contributors","subscribers_url":"https://api.github.com/repos/jtk54/clouddriver/subscribers","subscription_url":"https://api.github.com/repos/jtk54/clouddriver/subscription","commits_url":"https://api.github.com/repos/jtk54/clouddriver/commits{/sha}","git_commits_url":"https://api.github.com/repos/jtk54/clouddriver/git/commits{/sha}","comments_url":"https://api.github.com/repos/jtk54/clouddriver/comments{/number}","issue_comment_url":"https://api.github.com/repos/jtk54/clouddriver/issues/comments{/number}","contents_url":"https://api.github.com/repos/jtk54/clouddriver/contents/{+path}","compare_url":"https://api.github.com/repos/jtk54/clouddriver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jtk54/clouddriver/merges","archive_url":"https://api.github.com/repos/jtk54/clouddriver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jtk54/clouddriver/downloads","issues_url":"https://api.github.com/repos/jtk54/clouddriver/issues{/number}","pulls_url":"https://api.github.com/repos/jtk54/clouddriver/pulls{/number}","milestones_url":"https://api.github.com/repos/jtk54/clouddriver/milestones{/number}","notifications_url":"https://api.github.com/repos/jtk54/clouddriver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jtk54/clouddriver/labels{/name}","releases_url":"https://api.github.com/repos/jtk54/clouddriver/releases{/id}","deployments_url":"https://api.github.com/repos/jtk54/clouddriver/deployments","created_at":"2016-03-17T14:52:27Z","updated_at":"2016-03-17T14:52:32Z","pushed_at":"2016-09-12T15:19:56Z","git_url":"git://github.com/jtk54/clouddriver.git","ssh_url":"git@github.com:jtk54/clouddriver.git","clone_url":"https://github.com/jtk54/clouddriver.git","svn_url":"https://github.com/jtk54/clouddriver","homepage":null,"size":28604,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spinnaker:master","ref":"master","sha":"ddd9974711ddffc3d0399a773635708a2ab95a44","user":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"repo":{"id":37556951,"name":"clouddriver","full_name":"spinnaker/clouddriver","owner":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spinnaker/clouddriver","description":"read and write operations across cloud providers","fork":false,"url":"https://api.github.com/repos/spinnaker/clouddriver","forks_url":"https://api.github.com/repos/spinnaker/clouddriver/forks","keys_url":"https://api.github.com/repos/spinnaker/clouddriver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinnaker/clouddriver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinnaker/clouddriver/teams","hooks_url":"https://api.github.com/repos/spinnaker/clouddriver/hooks","issue_events_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/events{/number}","events_url":"https://api.github.com/repos/spinnaker/clouddriver/events","assignees_url":"https://api.github.com/repos/spinnaker/clouddriver/assignees{/user}","branches_url":"https://api.github.com/repos/spinnaker/clouddriver/branches{/branch}","tags_url":"https://api.github.com/repos/spinnaker/clouddriver/tags","blobs_url":"https://api.github.com/repos/spinnaker/clouddriver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinnaker/clouddriver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinnaker/clouddriver/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinnaker/clouddriver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinnaker/clouddriver/statuses/{sha}","languages_url":"https://api.github.com/repos/spinnaker/clouddriver/languages","stargazers_url":"https://api.github.com/repos/spinnaker/clouddriver/stargazers","contributors_url":"https://api.github.com/repos/spinnaker/clouddriver/contributors","subscribers_url":"https://api.github.com/repos/spinnaker/clouddriver/subscribers","subscription_url":"https://api.github.com/repos/spinnaker/clouddriver/subscription","commits_url":"https://api.github.com/repos/spinnaker/clouddriver/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinnaker/clouddriver/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinnaker/clouddriver/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinnaker/clouddriver/contents/{+path}","compare_url":"https://api.github.com/repos/spinnaker/clouddriver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinnaker/clouddriver/merges","archive_url":"https://api.github.com/repos/spinnaker/clouddriver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinnaker/clouddriver/downloads","issues_url":"https://api.github.com/repos/spinnaker/clouddriver/issues{/number}","pulls_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls{/number}","milestones_url":"https://api.github.com/repos/spinnaker/clouddriver/milestones{/number}","notifications_url":"https://api.github.com/repos/spinnaker/clouddriver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinnaker/clouddriver/labels{/name}","releases_url":"https://api.github.com/repos/spinnaker/clouddriver/releases{/id}","deployments_url":"https://api.github.com/repos/spinnaker/clouddriver/deployments","created_at":"2015-06-16T21:26:02Z","updated_at":"2016-09-09T15:15:48Z","pushed_at":"2016-09-12T15:19:57Z","git_url":"git://github.com/spinnaker/clouddriver.git","ssh_url":"git@github.com:spinnaker/clouddriver.git","clone_url":"https://github.com/spinnaker/clouddriver.git","svn_url":"https://github.com/spinnaker/clouddriver","homepage":null,"size":30876,"stargazers_count":64,"watchers_count":64,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":102,"mirror_url":null,"open_issues_count":7,"forks":102,"open_issues":7,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013"},"html":{"href":"https://github.com/spinnaker/clouddriver/pull/1013"},"issue":{"href":"https://api.github.com/repos/spinnaker/clouddriver/issues/1013"},"comments":{"href":"https://api.github.com/repos/spinnaker/clouddriver/issues/1013/comments"},"review_comments":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013/comments"},"review_comment":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/1013/commits"},"statuses":{"href":"https://api.github.com/repos/spinnaker/clouddriver/statuses/8fcf73a8d011e4c46cf607c6397d88922140c4af"}}}}
{"actor":{"display_login":"duftler"}}