Skip to content

Conversation

@Scanf-s
Copy link

@Scanf-s Scanf-s commented Jan 10, 2026

What changed?
Replaced common/tokenbucket with common/clock/ratelimiter in the CLI's AdminDelete function (tools/cli/admin_elastic_search_commands.go).

Why?
This PR is the first step toward resolving the issue #7562.
The current custom tokenbucket implementation is only used in two places

  • The AdminDelete function: Uses only basic rate limiting, seems straightforward to replace.
  • The common/persistence/wrappers/sampled module: Required priority support, which common/clock/ratelimiter does not currently support.

To replace the custom ratelimiter in the AdminDelete function, I followed the comments on the ratelimiter.go 84 line and used the Wait function to ensure it waits until a token is available. This allows the implementation to leverage context-based cancellation.

How did you test it?
Ran unit tests in admin_elastic_search_commands_test.go
image

Potential risks

Release notes

Documentation Changes

@Scanf-s Scanf-s changed the title Replace tokenbucket with standard limiter on CLI fix: Replace tokenbucket with standard limiter on CLI Jan 10, 2026
@Scanf-s Scanf-s force-pushed the fix/remove-tokenbucket-in-cli branch from 1429544 to b8d089e Compare January 10, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant