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

task: make setting service handle conflict on insert #9160

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chriswk
Copy link
Member

@chriswk chriswk commented Jan 28, 2025

Currently, in enterprise we're struggling with setting service and transactionality; all our verfications says that the setting key is not present, so setting-store happily tries to insert a new row with a new PK. However, somehow at the same time, the key already exists. This commit adds conflict handling to the insertNewRow.

Currently, in enterprise we're struggling with setting service and
transactionality; all our verfications says that the setting key is not
present, so setting-store happily tries to insert a new row with a new
PK. However, somehow at the same time, the key already exists. This
commit adds conflict handling to the insertNewRow.
@chriswk chriswk self-assigned this Jan 28, 2025
Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 10:39am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 10:39am

Copy link
Contributor

github-actions bot commented Jan 28, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Comment on lines 36 to 39
return this.db(TABLE)
.insert({ name, content })
.onConflict('name')
.merge();
Copy link
Contributor

Choose a reason for hiding this comment

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

We can potentially drop insertNewRow and make this change in insert which is actually trying to do an upsert

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Approved PRs
Development

Successfully merging this pull request may close these issues.

2 participants