Open
Description
Describe the feature request
Currently, throttler exposes a lot of methods and requires the client to follow a protocol for it to work properly. Instead, throttler should just wrap the code you want to execute and handle skips internally.
If anyone feels like contributing this might be a good option
Background
No response
Solution suggestions
return throttler.execute {
Log.d(TAG, "Refreshing toggles")
val response = doFetchToggles(ctx)
fetcherHeartbeatFlow.emit(HeartbeatEvent(response.status, response.error?.message))
return@execute response
}.orElseGet {
Log.i(TAG, "Skipping refresh toggles due to throttling")
fetcherHeartbeatFlow.emit(HeartbeatEvent(Status.THROTTLED))
return ToggleResponse(Status.THROTTLED)
}
This is just a sketch to avoid having to do
but needs to be looked at in more detail.Metadata
Metadata
Assignees
Type
Projects
Status