[Scheduler] Throw error on duplicate schedule provider service registration on the schedule name #60253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way the schedule providers work, either by tagging a service or using the AsSchedule attribute, can lead to a scenario where multiple ScheduleProviders register for the same schedule name (e.g.
default
).The problem arises when the CompilerPass simply overwrites the previously registered one without throwing a warning, a notice or anything else. The problem would be that a full ScheduleProvider would simply not register and therefore not run.
I decided to use the InvalidArgumentException from DI, as I could not get a trigger_error on E_USER_WARNING to show anything in a
dev
environment, in case I miss a scenario where this would actually be a desirable use case.Not sure if the test is complete enough for this scenario. I tried to base it on others found in HttpKernel.
Also not sure if this falls under "feature" or "bug fix", so I marked it as a feature above.