https://kotlinlang.org logo
Title
q

Quanta

07/21/2022, 5:45 PM
Does the library provide any built-in mechanism for handling rate limits? If not, what is the recommended way to handle it?
d

Dariusz Kuc

07/21/2022, 6:05 PM
👋 this not part of the library as it is more of a server concern than the graphql concern
if you are using
graphql-kotlin-spring-server
look into SpringBoot and rate limiting (e.g.
resilience4j
)
if you are using your own server implementation (e.g. ktor) then search for rate limiting for that target server
s

Shane Myrick

07/21/2022, 8:21 PM
If you wanted to do rate limiting by field you can create a custom directive but then it will be up to you to write the logic still to determine who is calling and how much they have called already. A lot of solutions in the JS ecosystem use Redis to keep that info in sync across instances