-
Notifications
You must be signed in to change notification settings - Fork 73
fix issue: Manual Job not be added into Scheduler #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…artzAttribute 2. fix typo for "Description"
There was a problem hiding this comment.
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 the issue where manual jobs were not being added into the scheduler. The changes include updating constructor signatures in SilkierQuartzAttribute to correct parameter naming and default values, adding a branch in QuartzHostedService to handle jobs without triggers, and updating the job registration overloads and their usages in the configuration and sample projects.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/SilkierQuartz/SilkierQuartzAttribute.cs | Corrects typo in property and parameter names from "Desciption" to "Description" and adds default values for optional parameters. |
src/SilkierQuartz/HostedService/QuartzHostedService.cs | Adds logic to automatically add jobs with no triggers into the scheduler. |
src/SilkierQuartz/HostedService/IJobRegistratorExtensions.cs | Updates overloads to introduce a durability flag and improve API consistency. |
src/SilkierQuartz/Configuration/ServiceCollectionExtensions.cs | Updates job registration to pass the durability flag based on the Manual property. |
sample2/Program.cs, sample/Startup.cs, sample2/Jobs/HelloJobAuto.cs, sample/Jobs/HelloJobAuto.cs | Removes the redundant group parameter and updates attribute usage to reflect naming corrections. |
@@ -59,7 +59,7 @@ public static IServiceCollection AddSilkierQuartz( | |||
types.ForEach(t => | |||
{ | |||
var so = t.GetCustomAttribute<SilkierQuartzAttribute>(); | |||
services.AddQuartzJob(t, so.Identity ?? t.Name, so.Group, so.Desciption ?? t.FullName); | |||
services.AddQuartzJob(t, so.Identity ?? t.Name, so.Manual ? true : false, so.Group, so.Description ?? t.FullName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider simplifying the boolean expression 'so.Manual ? true : false' to 'so.Manual' for improved readability.
services.AddQuartzJob(t, so.Identity ?? t.Name, so.Manual ? true : false, so.Group, so.Description ?? t.FullName); | |
services.AddQuartzJob(t, so.Identity ?? t.Name, so.Manual, so.Group, so.Description ?? t.FullName); |
Copilot uses AI. Check for mistakes.
@@ -43,25 +43,32 @@ public async Task StartAsync(CancellationToken cancellationToken) | |||
|
|||
foreach (var scheduleJob in _scheduleJobs) | |||
{ | |||
var isNewJob = true; | |||
foreach (var trigger in scheduleJob.Triggers) | |||
if (scheduleJob.Triggers != null && scheduleJob.Triggers.Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] If possible, ensure that 'scheduleJob.Triggers' is always initialized to avoid needing a null check and simplify the control flow.
if (scheduleJob.Triggers != null && scheduleJob.Triggers.Any()) | |
if (scheduleJob.Triggers.Any()) |
Copilot uses AI. Check for mistakes.
No description provided.