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 rate limit custom number #1153

Closed
wants to merge 1 commit into from
Closed

Conversation

gandarez
Copy link
Member

@gandarez gandarez commented Jan 6, 2025

This PR fixes setting custom number for heartbeat-rate-limit-seconds. Currently any value informed from config is completely ignored as the default value for the flag is 120. The easiest way was to make the default value zero as vipertools.FirstNonEmptyInt() only returns valid values that are not equal to zero and making it parsing correctly when set by flag or config file. @alanhamlett the drawback here is to instead of setting rate limit to zero it needs to be set to -1 (or any negative number) to get disabled.

Fixes #1147

@gandarez gandarez requested a review from alanhamlett January 6, 2025 02:27
@gandarez gandarez self-assigned this Jan 6, 2025
@gandarez gandarez force-pushed the bugfix/rate-limit-param branch from abdb0d2 to f9aefe9 Compare January 6, 2025 02:27
@gandarez gandarez enabled auto-merge January 6, 2025 02:28
@gandarez gandarez force-pushed the bugfix/rate-limit-param branch 2 times, most recently from 3fa9eca to 7ab03d6 Compare January 6, 2025 02:29
USAGE.md Outdated
@@ -91,7 +91,7 @@ some/submodule/name = new project name
| api_key | Your wakatime api key. | _string_ | |
| api_key_vault_cmd | A command to get your api key, perhaps from some sort of secure vault. Actually a space-separated list of an executable and its arguments. Executables in PATH can be referred to by their basenames. Shell syntax not supported. | _string_ | |
| api_url | The WakaTime API base url. | _string_ | <https://api.wakatime.com/api/v1> |
| heartbeat_rate_limit_seconds | Rate limit sending heartbeats to the API once per duration. Set to 0 to disable rate limiting. | _int_ | `120` |
| heartbeat_rate_limit_seconds | Rate limit sending heartbeats to the API once per duration. Set to -1 to disable rate limiting. | _int_ | `120` |
Copy link

Choose a reason for hiding this comment

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

It seems there's a same issue with the timeout as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

@leekib thanks for pointing it out, I fixed it with #1154

@gandarez gandarez disabled auto-merge January 6, 2025 10:41
@gandarez gandarez force-pushed the bugfix/rate-limit-param branch from 7ab03d6 to ce559c9 Compare January 6, 2025 12:06
@gandarez
Copy link
Member Author

gandarez commented Jan 6, 2025

Closing in favor of #1154

@gandarez gandarez closed this Jan 6, 2025
@wakatime wakatime deleted a comment from codecov bot Jan 6, 2025
@gandarez gandarez deleted the bugfix/rate-limit-param branch January 6, 2025 12:54
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.

--heartbeat-rate-limit-seconds flag is not properly configured in the config file
2 participants