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: allow creation of multiple project envs #2514

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

Conversation

DanielHougaard
Copy link
Contributor

Description 📣

Previously when creating multiple project environments at once, it was possible that our database would throw an error, due to the unique composite constraint on project ID / position. This would happen because the transactions would turn into race conditions of whichever would first finish wish the selected position.

The solution for this is to use the keystore to ensure that only one project environment update / create / delete operation will run at once.

Type ✨

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

try {
if (!lock) {
await keyStore.waitTillReady({
key: `${KeyStorePrefixes.WaitUntilReadyCreateProjectEnvironment}${projectId}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should have used a function for this key name because right now the next person will have to remembert to append the project id on it

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