ktor-client-throttle

Rate-limits HTTP client requests with configurable limit and refill period, offering token-refill policies and optional automatic retries when limit exceeded.

JVMKotlin/NativeWasm
GitHub stars3
Authorsbrudaswen
Open issues0
LicenseMIT License
Creation date5 months ago

Last activity3 months ago
Latest release1.0.0 (5 months ago)

Ktor Client Throttle Plugin

Maven Central Snapshot CI Status Codecov License

The Throttle plugin allows you to limit the number of requests within a certain time period.

Gradle Dependencies

[versions]
ktor-client-throttle = "1.0.0"

[libraries]
ktor-client-throttle = { group = "de.brudaswen.ktor.client.throttle", name = "ktor-client-throttle", version.ref = "ktor-client-throttle" }
// From Gradle version catalog
implementation(libs.ktor.client.throttle)

// Manually
implementation("de.brudaswen.ktor.client.throttle:ktor-client-throttle:1.0.0")

Usage

HttpClient {
    install(HttpRequestThrottle) {
        throttler(
            limit = 10,
            refillPeriod = 30.seconds,
            retry = true,
        )
    }
}

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
JVMKotlin/NativeWasm
GitHub stars3
Authorsbrudaswen
Open issues0
LicenseMIT License
Creation date5 months ago

Last activity3 months ago
Latest release1.0.0 (5 months ago)

Ktor Client Throttle Plugin

Maven Central Snapshot CI Status Codecov License

The Throttle plugin allows you to limit the number of requests within a certain time period.

Gradle Dependencies

[versions]
ktor-client-throttle = "1.0.0"

[libraries]
ktor-client-throttle = { group = "de.brudaswen.ktor.client.throttle", name = "ktor-client-throttle", version.ref = "ktor-client-throttle" }
// From Gradle version catalog
implementation(libs.ktor.client.throttle)

// Manually
implementation("de.brudaswen.ktor.client.throttle:ktor-client-throttle:1.0.0")

Usage

HttpClient {
    install(HttpRequestThrottle) {
        throttler(
            limit = 10,
            refillPeriod = 30.seconds,
            retry = true,
        )
    }
}

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.