Skip to content

chore: gatekeeper fix race condition in SQLite DB#1028

Merged
Bushstar merged 2 commits into
mainfrom
bush/gk-sqlite-race
Sep 12, 2025
Merged

chore: gatekeeper fix race condition in SQLite DB#1028
Bushstar merged 2 commits into
mainfrom
bush/gk-sqlite-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 addresses a race condition in the SQLite database implementation by introducing proper concurrency control mechanisms. The changes ensure database operations are executed safely in a concurrent environment through transaction management and exclusive operation execution.

  • Adds a locking mechanism (runExclusive) to prevent concurrent database operations
  • Wraps database operations in transactions using a new withTx helper method
  • Refactors existing methods to use the new concurrency-safe patterns

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/gatekeeper/src/db/sqlite.ts Implements concurrency control with runExclusive method, transaction wrapper, and refactors all database operations to use these safety mechanisms
packages/gatekeeper/src/db/redis.ts Removes unnecessary runExclusive wrapper from removeFromBatch method

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

Comment thread packages/gatekeeper/src/db/sqlite.ts
Comment thread packages/gatekeeper/src/db/sqlite.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Bushstar Bushstar merged commit 19e1cbc into main Sep 12, 2025
14 checks passed
@Bushstar Bushstar deleted the bush/gk-sqlite-race branch September 12, 2025 13:37
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 SQLite DB

3 participants