Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Apr 1, 2024

Bumps com.michael-bull.kotlin-retry:kotlin-retry from 1.0.9 to 2.0.0.

Release notes

Sourced from com.michael-bull.kotlin-retry:kotlin-retry's releases.

2.0.0

Version 2.0.0 represents a major breaking change in the form of an underlying rewrite and support all three tiers of Kotlin/Native.

Multiplatform

The project has been converted to be multiplatform, matching compatibility with kotlinx-coroutines support for all three tiers of Kotlin/Native.

The full list of platform targets can be found in the kotlin-conventions Gradle plugin.

Policy Authoring Changes

The implementation no longer relies on CoroutineContext to persist the state of retry attempts. Instead, the RetryPolicy (now a functional interface) is passed the attempt that just failed. This makes it clear on the callsite what information about the failed attempt is available, instead of being expected to know what fields are in the coroutineContext.retryStatus.

The attempt argument for a RetryPolicy contains:

  • The failure as a generic.
    • In the default case of invoking the retry or runRetrying function, this will be Throwable, however leaves future oppurtunity for a Result-backed retry function that uses an Err instead of a Throwable.
  • A zero-based attempt number.
    • 0 means the invocation of the block has failed and no attempts have been made to retry invoking the block.
    • 1 means the invocation of the block has failed, and one attempt to retry invoking the block also failed - totalling two attempts and one retry.
  • The delay between the failed attempt and the attempt prior.
  • The cumulativeDelay across all attempts.

Before:

public fun binaryExponentialBackoff(min: Long, max: Long): RetryPolicy<*> {
    require(min > 0) { "min must be positive, but was $min" }
    require(max > 0) { "max must be positive, but was $max" }
return {
    val attempt = coroutineContext.retryStatus.attempt
    val delay = min(max, min saturatedMultiply attempt.binaryExponential())
RetryAfter(delay)

}

}

After:

public fun <E> binaryExponentialBackoff(min: Long, max: Long): RetryPolicy<E> {
    require(min > 0) { "min must be positive, but was $min" }
    require(max > 0) { "max must be positive, but was $max" }
return RetryPolicy { attempt -&gt;
    val delay = min(max, min saturatedMultiply attempt.number.binaryExponential())
    RetryAfter(delay)
}

</tr></table>

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [com.michael-bull.kotlin-retry:kotlin-retry](https://github.com/michaelbull/kotlin-retry) from 1.0.9 to 2.0.0.
- [Release notes](https://github.com/michaelbull/kotlin-retry/releases)
- [Commits](michaelbull/kotlin-retry@1.0.9...2.0.0)

---
updated-dependencies:
- dependency-name: com.michael-bull.kotlin-retry:kotlin-retry
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Apr 1, 2024

The following labels could not be found: gradle, dependencies.

@dependabot dependabot bot requested a review from sureshg April 1, 2024 01:07
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@sureshg sureshg merged commit 5982428 into main Apr 1, 2024
@dependabot dependabot bot deleted the dependabot/gradle/com.michael-bull.kotlin-retry-kotlin-retry-2.0.0 branch April 1, 2024 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants