Skip to content

Commit

Permalink
fix(titus): Adjust retries on upsert scaling policy operation (#4090)
Browse files Browse the repository at this point in the history
- wrap a retry on scaling policy create call for good measure
- fix retry count/timeout for if checking scaling policy was applied
- make retry to be exponential
  • Loading branch information
jeyrschabu committed Oct 17, 2019
1 parent f62b3e0 commit a88451c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class UpsertTitusScalingPolicyAtomicOperation implements AtomicOperation<Map> {

task.updateStatus BASE_PHASE, "Create Scaling Policy request constructed, sending..."

ScalingPolicyID result = client.createScalingPolicy(requestBuilder.build())
ScalingPolicyID result = retrySupport.retry({ ->
client.createScalingPolicy(requestBuilder.build())
}, 10, 3000, false)

task.updateStatus BASE_PHASE, "Create Scaling Policy succeeded; new policy ID: ${result.id}; monitoring creation..."

Expand All @@ -99,9 +101,9 @@ class UpsertTitusScalingPolicyAtomicOperation implements AtomicOperation<Map> {
retrySupport.retry({ ->
ScalingPolicyResult updatedPolicy = client.getScalingPolicy(result.id)
if (!updatedPolicy || (updatedPolicy.getPolicyState().state != ScalingPolicyState.Applied)) {
throw new IllegalStateException("New policy did not transition to applied state within 45 seconds")
throw new IllegalStateException("Timed out while waiting for policy to be applied")
}
}, 5000, 10, false)
}, 10, 5000, true)
}

}

0 comments on commit a88451c

Please sign in to comment.