Skip to content

chore: gatekeeper fix race condition in Mongo DB#1024

Merged
Bushstar merged 3 commits into
mainfrom
bush/gk-mongo-race
Sep 10, 2025
Merged

chore: gatekeeper fix race condition in Mongo DB#1024
Bushstar merged 3 commits into
mainfrom
bush/gk-mongo-race

Conversation

@Bushstar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes race conditions in the MongoDB implementation of the gatekeeper database by replacing multiple operations with atomic MongoDB operations.

  • Replaces the setEvents method's delete-then-add pattern with a single atomic $set operation
  • Updates clearQueue to use MongoDB's atomic $pull operation instead of read-modify-write pattern
  • Adds consistent type usage with the QueueDoc interface

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/gatekeeper/src/db/mongo.ts Outdated
Comment thread packages/gatekeeper/src/db/mongo.ts
@Bushstar Bushstar merged commit 0e25143 into main Sep 10, 2025
14 checks passed
@Bushstar Bushstar deleted the bush/gk-mongo-race branch September 10, 2025 13:23
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.

Fix race condition in Gatekeeper Mongo DB

3 participants