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

[datadog_csm_threats_agent_rules] Add a by resource lock to prevent 409s #2332

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

Malo10LeGoff
Copy link
Contributor

Previous PR, added the new csm_agent_threats resource. Thing is, sometimes we got 409s from the backend because of requests accessing the same resource.
This PR removes this possibility by introducing a lock by resource.

@Malo10LeGoff Malo10LeGoff requested a review from a team as a code owner March 20, 2024 15:02
@Malo10LeGoff Malo10LeGoff changed the title [CWS-1047] - Add a by resource lock to prevent 409s [datadog_csm_threats_agent_rules] - Add a by resource lock to prevent 409s Mar 20, 2024
@Malo10LeGoff Malo10LeGoff changed the title [datadog_csm_threats_agent_rules] - Add a by resource lock to prevent 409s [datadog_csm_threats_agent_rules] Add a by resource lock to prevent 409s Mar 20, 2024
jgrillo-ddog
jgrillo-ddog previously approved these changes Mar 20, 2024
Copy link

@jgrillo-ddog jgrillo-ddog left a comment

Choose a reason for hiding this comment

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

LGTM, one question

@@ -117,6 +122,9 @@ func (r *csmThreatsAgentRuleResource) Read(ctx context.Context, request resource
return
}

csmThreatsMutex.Lock()

Choose a reason for hiding this comment

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

Do we need to acquire the lock on Read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed !

@skarimo skarimo merged commit 6b5963c into master Mar 20, 2024
10 checks passed
@skarimo skarimo deleted the malo.legoff/cws-1047-lock branch March 20, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants