Skip to content

Comments

fix issue: Manual Job not be added into Scheduler#167

Merged
maikebing merged 3 commits intoIoTSharp:masterfrom
Bonnie2980:master
May 22, 2025
Merged

fix issue: Manual Job not be added into Scheduler#167
maikebing merged 3 commits intoIoTSharp:masterfrom
Bonnie2980:master

Conversation

@Bonnie2980
Copy link

No description provided.

@maikebing maikebing requested a review from Copilot May 21, 2025 04:30
Copy link

Copilot AI left a 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.

{
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);
Copy link

Copilot AI May 21, 2025

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.

Suggested change
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.
{
var isNewJob = true;
foreach (var trigger in scheduleJob.Triggers)
if (scheduleJob.Triggers != null && scheduleJob.Triggers.Any())
Copy link

Copilot AI May 21, 2025

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.

Suggested change
if (scheduleJob.Triggers != null && scheduleJob.Triggers.Any())
if (scheduleJob.Triggers.Any())

Copilot uses AI. Check for mistakes.
@maikebing maikebing merged commit 484f1eb into IoTSharp:master May 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants