Skip to content

fix(sync): prevent sync race condition with replace option#1

Draft
google-labs-jules[bot] wants to merge 2 commits into
masterfrom
fix-replace-race-condition
Draft

fix(sync): prevent sync race condition with replace option#1
google-labs-jules[bot] wants to merge 2 commits into
masterfrom
fix-replace-race-condition

Conversation

@google-labs-jules

Copy link
Copy Markdown

When using the replace=true sync option on a resource that is
initially missing, a race condition can occur. The first sync
correctly creates the resource, but the second sync attempts to
create it again, resulting in an "already exists" error.

This commit fixes the race condition by marking the resource as
Succeeded immediately after it has been created with the
replace=true option. This prevents the resource from being
synced again in the same operation.

When using the `replace=true` sync option on a resource that is
initially missing, a race condition can occur. The first sync
correctly creates the resource, but the second sync attempts to
create it again, resulting in an "already exists" error.

This commit fixes the race condition by marking the resource as
`Succeeded` immediately after it has been created with the
`replace=true` option. This prevents the resource from being
synced again in the same operation.
When using the `replace=true` sync option on a resource that is
initially missing, a race condition can occur. The first sync
correctly creates the resource, but the second sync attempts to
create it again, resulting in an "already exists" error.

This commit fixes the race condition by marking the resource as
`Succeeded` immediately after it has been created with the
`replace=true` option. This prevents the resource from being
synced again in the same operation.

A new test case has been added to verify the fix.
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.

0 participants