Skip to content

Releases: tiper/KtorRequestDeduplication

3.1.1

17 Apr 11:13
ecdfb78

Choose a tag to compare

What's Changed

  • Set JVM target to 1.8 for improved compatibility by @tiper in #11

Full Changelog: 3.1.0...3.1.1

3.1.0

07 Mar 15:06
c2542f9

Choose a tag to compare

What's New

A correctness release. The plugin now plays nicely with libraries that cancel and restart coroutines on recomposition.


🐛 Bug Fixes

  • Cancellation incorrectly propagated to non-cancelled waiters — if one coroutine cancelled, other still-active waiters could get hit with a CancellationException they didn't ask for. They now correctly retry as a deduplicated group and get their response.
  • Premature entry removal — the first waiter to finish could remove the shared entry from the map while others were still using it.
  • Cleanup skipped under cancellationmutex.withLock inside finally could be interrupted by CancellationException when the coroutine was already cancelled, leaving stale entries in the map.

✨ Improvements

  • minWindow — new config option that holds the response open for a minimum number of milliseconds, giving late-joining concurrent requests a chance to deduplicate against fast responses (errors, cache hits, etc.).
    install(RequestDeduplication) {
        minWindow = 50 // ms
    }

Full Changelog: 3.0.0...3.1.0

3.0.0

03 Feb 10:27
ad572f0

Choose a tag to compare

This release adds full Ktor 3.0.0+ support and expands Kotlin Multiplatform target coverage. The request deduplication behavior remains the same, now validated against Ktor 3.x.

Highlights

  • Ktor 3.0.0+ support
  • Expanded platform targets (including WebAssembly and Android Native)
  • Aligned versioning: use plugin v3.x.x with Ktor 3.x

Supported Platforms (v3.x.x)

  • ✅ JVM (Java 8+)
  • ✅ Android (API 21+)
  • ✅ Android Native (arm32, arm64, x86, x64)
  • ✅ iOS (arm64, x64, simulatorArm64)
  • ✅ tvOS (x64, arm64, simulatorArm64)
  • ✅ watchOS (arm32, arm64, x64, simulatorArm64, deviceArm64)
  • ✅ macOS (x64, arm64)
  • ✅ Linux (x64, arm64)
  • ✅ Windows (mingwX64)
  • ✅ JavaScript (Browser, Node.js)
  • ✅ WebAssembly (wasmJs - Browser, Node.js)

Compatibility

  • Plugin v3.x.xKtor 3.0.0+
  • Plugin v2.x.xKtor 2.3.0+

Installation

dependencies {
    implementation("io.github.tiper:ktor-client-deduplication:3.x.x")
}

Upgrade Guidance

  • If you are on Ktor 2.x, stay on v2.x.x of this plugin.
  • If you upgrade to Ktor 3.x, switch to v3.x.x.

2.0.0

03 Feb 09:29
feade3a

Choose a tag to compare

🎉 First production-ready release of Ktor Client Request Deduplication

✨ Features

Deduplication

  • Prevents duplicate concurrent HTTP requests
  • Multiple identical requests → one actual HTTP call
  • Configurable by HTTP method and headers

Performance

  • O(1) deduplication check
  • ~500ns overhead per request (0.0005% of network time)
  • Smart memory sharing: 1MB × 10 callers = 1MB memory (not 10MB)

Safety

  • Thread-safe (Mutex synchronization)
  • Proper cancellation handling (SupervisorJob)
  • Error response deduplication
  • 29 comprehensive unit tests