Enable WAL to improve write performance and add db logger#137
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances SQLite handling by centralizing database setup, configuring WAL mode with a busy timeout, and adding a concurrent-creation test.
- Switches test database initialization to use
NewDatabasewith uniform config - Implements verbose GORM logging, WAL journal mode, and a 5000ms busy timeout in
NewDatabase - Adds
TestConcurrentCreateTaskto verify concurrent task creation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/utils/test/database.go | Replaced direct GORM open with dbutil.NewDatabase; missing fmt import |
| internal/utils/database/database.go | Introduced NewDatabase method with configurable log level, WAL, and busy timeout |
| internal/repos/task/concurrency_test.go | Added a concurrency test suite for creating tasks under contention |
Comments suppressed due to low confidence (2)
internal/repos/task/concurrency_test.go:31
- [nitpick] The PR description mentions testing concurrent updates, but this test only covers task creation. Consider adding scenarios for concurrent updates or adjusting the PR description to match the implemented test.
func (s *TaskConcurrencyTestSuite) TestConcurrentCreateTask() {
internal/utils/test/database.go:23
- fmt.Sprintf is used but the fmt package is not imported, which will cause a compile error. Add
import "fmt".
suite.dbFilePath = fmt.Sprintf("%s/testdb_%d.db", os.TempDir(), time.Now().UnixNano())
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
dkhalife
added a commit
that referenced
this pull request
Oct 5, 2025
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
go test ./...https://chatgpt.com/codex/tasks/task_e_686b37e1f23c832aa720cb583b5df093