Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: when skipping a call due to throttle count one more skipped #100

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

gastonfournier
Copy link
Contributor

About the changes

When skipping http calls due to throttling we should also count that we skipped that call so the throttler can recover. This is done in the metrics implementation:

but not in the feature toggle fetcher.

Closes #99

Discussion points

Maybe this can be refactored so the client of the throttler doesn't have to remember to call skipped. I have something like this in mind but it can be something good for a contribution, as I'm prioritizing fixing the bug.

        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)
        }

Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. might be worth it to put your thoughts about next step in an issue?

@gastonfournier
Copy link
Contributor Author

LGTM. might be worth it to put your thoughts about next step in an issue?

Added #101

@gastonfournier gastonfournier merged commit 1a902c0 into main Jan 16, 2025
3 checks passed
@gastonfournier gastonfournier deleted the fix-throttled-feature-fetch-should-recover branch January 16, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

UnleashFetcher won't recover from throttled state
2 participants