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: Acquire lock once outside of sendWithRetries #134

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

arthurpitman
Copy link
Contributor

@arthurpitman arthurpitman commented Sep 20, 2024

In https://github.com/Dynatrace/dynatrace-configuration-as-code-core/blob/main/api/rest/client.go, func (c *Client) sendWithRetries(...) calls itself recursively, but (tries to) acquire a lock each time. This causes the function to deadlock.

Proposed solution is to only acquire this lock once, outside of sendWithRetries(...).

Only issue is that the rate limiter may sleep once it acquires the lock, but as this is shared by all goroutines accessing the client, this should have no impact.

Copy link

Test Results

  3 files  ±0   48 suites  ±0   19s ⏱️ ±0s
252 tests ±0  252 ✅ ±0  0 💤 ±0  0 ❌ ±0 
756 runs  ±0  756 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit ceef571. ± Comparison against base commit 5f8d3b0.

@arthurpitman arthurpitman marked this pull request as ready for review September 20, 2024 14:34
@arthurpitman arthurpitman requested a review from a team as a code owner September 20, 2024 14:34
@arthurpitman arthurpitman merged commit 3ae2731 into main Sep 23, 2024
9 checks passed
@arthurpitman arthurpitman deleted the fix/move-lock-in-send-with-retries branch September 23, 2024 06:57
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.

2 participants