feat: auto-register quque job when created via CLI#1017
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to automatically register queue jobs when they are created via the CLI. Key changes include updating the job stub to return a new signature string, modifying the job make command to handle an additional signature parameter and perform registration by updating the providers file, and adding a new matcher for jobs in the match package.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| queue/console/job_stubs.go | Changed the job stub Signature() return value from "DummyName" to "DummySignature" to align with new stub replacement. |
| queue/console/job_make_command_test.go | Updated tests to verify both job creation and registration behaviors, including handling of warning messages. |
| queue/console/job_make_command.go | Modified to pass an extra signature parameter to the stub population and to update the providers file with job registration. |
| packages/match/helper_test.go & helper.go | Added a new matcher for queue jobs to support the auto-registration functionality. |
| errors/list.go | Added a new error (QueueJobRegisterFailed) for use when job registration fails. |
Comments suppressed due to low confidence (1)
queue/console/job_stubs.go:15
- Ensure that the stub string 'DummySignature' is consistently used with the populateStub method and job generation process to avoid mismatches in the job signature.
return "DummySignature"
|
|
||
| ctx.Success("Job created successfully") | ||
|
|
||
| if err = modify.GoFile(filepath.Join("app", "providers", "queue_service_provider.go")). |
There was a problem hiding this comment.
Consider checking for the existence of 'queue_service_provider.go' prior to applying modifications so that a missing file does not trigger a registration warning in production.
| if err = modify.GoFile(filepath.Join("app", "providers", "queue_service_provider.go")). | |
| providerFilePath := filepath.Join("app", "providers", "queue_service_provider.go") | |
| if !file.Exists(providerFilePath) { | |
| ctx.Warning(fmt.Sprintf("File %s does not exist. Skipping job registration.", providerFilePath)) | |
| return nil | |
| } | |
| if err = modify.GoFile(providerFilePath). |
5e2d171 to
36c7174
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1017 +/- ##
==========================================
+ Coverage 70.92% 70.97% +0.05%
==========================================
Files 170 170
Lines 11682 11705 +23
==========================================
+ Hits 8285 8308 +23
Misses 3044 3044
Partials 353 353 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📑 Description
Closes https://github.com/goravel/goravel/issues/
✅ Checks