-
Notifications
You must be signed in to change notification settings - Fork 11
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
Multiple AddNCronJob only registers ones #138
Comments
Hey @skarum No that is absolutely not intentional (at least until now :D) and should be fixed! Thanks for the report! |
Ohh - can see I forgot to link to the commit: 0fe7e66#diff-997ac4e971e8a1108f07128317dfa5a16164555c9220704a45a2d7f26ff01eb0 |
As a workaround, you can "just" have one call: services.AddNCronJob(
builder => builder
.AddJob<TestJob1>(o => o.WithCronExpression("0/1 * * * * *"))
.AddJob<TestJob2>(...)
); |
@nulltoken we might wanna change that in the future to remove ambiguity (and make our code simpler) |
Thanks, that could work. Unfortunately I have decentralized my setup, where different parts of my code can just add stuff to the IOC container, including registering a job. So, If you are going to fix it so it'll work in old way I'll just wait for the next release. If not I'll adjust my code. :-) |
I think I have a fix - which I will push as a preview in a few minutes |
A new |
Describe the bug
Prior to version 3.3.3 you could register multiple jobs by calling
AddNCronJob
multiple times.If I had a setup like this:
Current behavior
Only
TestJob1
is executedExpected behavior
Both
TestJob1
andTestJob2
should be executedVersion information
I think the change from
builder.RegisterJobs();
toservices.TryAddSingleton(jobRegistry);
in this commit is the cause of this behavior, but I'm not sure if it's intentional or a bug?If this is intentional I think the second call to
.AddNCronJob(...
should throw an exception.The text was updated successfully, but these errors were encountered: