Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1054 +/- ##
==========================================
+ Coverage 71.07% 71.24% +0.17%
==========================================
Files 178 178
Lines 12446 12548 +102
==========================================
+ Hits 8846 8940 +94
- Misses 3211 3217 +6
- Partials 389 391 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the queue database driver by removing the JobRecord interface and consolidating job logic into DatabaseJobRecord; it also updates tests and adds a new GetJobStorer method to improve job management.
- Consolidated
JobRecordmethods intoDatabaseJobRecordand removed the interface and its mock - Renamed references from
DatabaseJobtoDatabaseJobRecordand updated corresponding tests - Introduced
GetJobStoreron theQueueinterface and in the application, along with a mock implementation
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| queue/driver_database_test.go | Tests updated to use DatabaseJobRecord instead of DatabaseJob |
| queue/driver_database_job.go | Replaced DatabaseJob struct and methods with DatabaseJobRecord |
| queue/driver_database.go | Updated Pop and Push to work with DatabaseJobRecord |
| queue/application.go | Added GetJobStorer method |
| mocks/queue/Queue.go | Added mock implementation for GetJobStorer |
| mocks/queue/JobRecord.go | Removed obsolete JobRecord mock |
| contracts/queue/queue.go | Added GetJobStorer to the Queue interface and fixed comments |
| contracts/queue/job.go | Removed the now-unused JobRecord interface |
Comments suppressed due to low confidence (3)
queue/driver_database.go:53
- [nitpick] Rename the local variable from
databaseJobtojobRecordto align with its type name and improve clarity.
var databaseJob DatabaseJobRecord
queue/driver_database.go:105
- [nitpick] Consider renaming the variable
jobtojobRecordfor consistency with the struct name.
job := DatabaseJobRecord{
| // GetJobs get all jobs | ||
| // GetJobs gets all jobs | ||
| GetJobs() []Job | ||
| // GetJobStorer gets job storer |
There was a problem hiding this comment.
[nitpick] Update the GoDoc comment to follow conventions, e.g., "// GetJobStorer returns the job storer."
| return r.jobStorer.All() | ||
| } | ||
|
|
||
| func (r *Application) GetJobStorer() queue.JobStorer { |
There was a problem hiding this comment.
[nitpick] Add a GoDoc comment above this method, for example: "// GetJobStorer returns the application’s JobStorer."
📑 Description
Closes goravel/goravel#651
This pull request refactors the queue system by removing the
JobRecordinterface and its associated mock implementation, consolidating functionality into theDatabaseJobRecordstruct. It also introduces a new method,GetJobStorer, to enhance job management. The changes primarily focus on simplifying the codebase, improving naming consistency, and updating tests to reflect these modifications.Codebase Simplification:
JobRecordinterface and its mock implementation (mocks/queue/JobRecord.go) and consolidated its methods (IncrementandTouch) into theDatabaseJobRecordstruct (queue/driver_database_job.go). [1] [2] [3]DatabaseJobwithDatabaseJobRecordthroughout the codebase, including in the database driver and related tests (queue/driver_database.go,queue/driver_database_job.go,queue/driver_database_job_test.go,queue/driver_database_test.go). [1] [2] [3] [4] [5]New Functionality:
GetJobStorermethod to theQueueinterface and its mock implementation to facilitate job storage management (contracts/queue/queue.go,mocks/queue/Queue.go,queue/application.go). [1] [2] [3]Naming Consistency:
DatabaseJobtoDatabaseJobRecordand updating associated method calls and test assertions (queue/driver_database_job.go,queue/driver_database_test.go). [1] [2] [3]Documentation and Comments:
Queueinterface (contracts/queue/queue.go).✅ Checks