Fix slow command exit by reducing analytics timeout#525
Open
coding-shalabh wants to merge 1 commit intoDopplerHQ:masterfrom
Open
Fix slow command exit by reducing analytics timeout#525coding-shalabh wants to merge 1 commit intoDopplerHQ:masterfrom
coding-shalabh wants to merge 1 commit intoDopplerHQ:masterfrom
Conversation
Fixes slow exit issue where `doppler secrets get` waits 5-10 seconds before exiting. Analytics requests now timeout after 2 seconds instead of 10 seconds, significantly improving command responsiveness. The root cause was that analytics requests used the default 10-second HTTP timeout and the main program waited for the analytics goroutine to complete via WaitGroup before exiting. This meant any delay in the analytics server response would block command exit. Changes: - Add AnalyticsTimeoutDuration constant (2 seconds) - Use shorter timeout specifically for analytics requests - Analytics failures don't block command execution Fixes DopplerHQ#511
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #511 - Commands taking 10+ seconds to exit after completion
Root Cause
The analytics module uses
global.WaitGroupwhich blocks program exit until all analytics requests complete. These requests had a 10-second timeout, causing the CLI to hang for up to 10 seconds on every command.Changes
Added a separate shorter timeout (2 seconds) specifically for analytics requests to avoid blocking command execution:
AnalyticsTimeoutDuration = 2 * time.Secondinpkg/http/config.goCaptureCommand()andCaptureEvent()inpkg/http/analytics.goto use the shorter timeoutTesting
Before:
After:
Impact
Related Issues
doppler secrets getwaits a few seconds before exiting #511