Skip to content

Fix slow command exit by reducing analytics timeout#525

Open
coding-shalabh wants to merge 1 commit intoDopplerHQ:masterfrom
coding-shalabh:fix/issue-511-slow-exit
Open

Fix slow command exit by reducing analytics timeout#525
coding-shalabh wants to merge 1 commit intoDopplerHQ:masterfrom
coding-shalabh:fix/issue-511-slow-exit

Conversation

@coding-shalabh
Copy link

Summary

Fixes #511 - Commands taking 10+ seconds to exit after completion

Root Cause

The analytics module uses global.WaitGroup which 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:

  • Added AnalyticsTimeoutDuration = 2 * time.Second in pkg/http/config.go
  • Modified CaptureCommand() and CaptureEvent() in pkg/http/analytics.go to use the shorter timeout

Testing

Before:

time doppler run -- echo "test"
# Takes 10+ seconds to exit

After:

time doppler run -- echo "test"  
# Exits in ~2 seconds

Impact

  • 80% reduction in command exit time (10s → 2s)
  • Analytics requests still complete in most cases (2s is sufficient for most networks)
  • Improves user experience significantly
  • No breaking changes

Related Issues

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
@coding-shalabh coding-shalabh requested a review from a team as a code owner March 8, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] doppler secrets get waits a few seconds before exiting

1 participant