-
Notifications
You must be signed in to change notification settings - Fork 11
fix: move queue insert out of tx in env create endpoint #505
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
Conversation
WalkthroughThis update refactors the POST handler for environment creation in the web service API. The existence check for an environment by name is now performed before starting the database transaction, rather than inside it. The transaction is limited to the upsert operation and related tasks. After the transaction, the code conditionally enqueues update or creation events based on whether the environment previously existed. Corresponding end-to-end tests were updated to use a more complex resource selector and to refine the assertions for resource matching. A trailing blank line was also removed from a YAML test configuration file. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant DB
participant Queue
Client->>API: POST /environments
API->>DB: Check if environment exists by name
alt Environment exists or not
API->>DB: Begin transaction
API->>DB: Upsert environment and related data
API->>DB: Commit transaction
end
alt Environment existed before
API->>Queue: Enqueue update event
else New environment
API->>Queue: Enqueue creation event
end
API-->>Client: Respond with result
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Summary by CodeRabbit
Refactor
Tests