fix issue: Manual Job not be added into Scheduler#167
fix issue: Manual Job not be added into Scheduler#167maikebing merged 3 commits intoIoTSharp:masterfrom
Conversation
…artzAttribute 2. fix typo for "Description"
There was a problem hiding this comment.
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. |
| { | ||
| 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.
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); |
| { | ||
| var isNewJob = true; | ||
| foreach (var trigger in scheduleJob.Triggers) | ||
| if (scheduleJob.Triggers != null && scheduleJob.Triggers.Any()) |
There was a problem hiding this comment.
[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()) |
No description provided.