Skip to content
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

Make use of NoOpTaskScheduler to disable task scheduling in tests #38954

Open
wilkinsona opened this issue Jan 2, 2024 · 6 comments
Open

Make use of NoOpTaskScheduler to disable task scheduling in tests #38954

wilkinsona opened this issue Jan 2, 2024 · 6 comments
Labels
status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Jan 2, 2024

A NoOpTaskScheduler has been added to Spring Framework. We should look at how we can use it to disable scheduled tasks in integration tests (and perhaps at runtime as well) probably via some opt-in mechanism.

@breader124
Copy link

Hey, I'd like to start working on this enhancement. Would you be able to assign it to me @wilkinsona?

@wilkinsona
Copy link
Member Author

Thanks for the offer, @breader124, but I don't think we know how we want to implement this one yet. Unfortunately, other higher priority work means that we don't have the cycles to figure that out right now. If you have some time to sketch out some ideas when that would be great, but please be aware that it may be wasted effort if we decide to take a different direction.

@wilkinsona wilkinsona added the status: pending-design-work Needs design work before any code can be developed label Mar 22, 2024
@breader124
Copy link

I'm happy to help. I'll try to think about possible solutions and will post them here to review when I'm ready

@breader124
Copy link

@wilkinsona, I did some investigation and it seems that a reasonable solution would be to introduce spring.task.scheduling.enabled property and based on its value:

  • create either ThreadPoolTaskScheduler or SimpleAsyncTaskScheduler bean when the new property is not explicitly set to false or when it's missing
  • create the bean of type NoOpTaskScheduler when the property is explicitly set to false

I also propose to leave the creation of all beans of TaskSchedulerBuilder type when scheduling is disabled. If anyone injects them for any reason, it'd be problematic when they disappear after setting the spring.task.scheduling.enabled to false.

How does it sound to you? Do you see more aspects to consider?

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Apr 18, 2024
@philwebb philwebb modified the milestones: 3.3.x, 3.4.x May 6, 2024
@philwebb philwebb removed the for: team-meeting An issue we'd like to discuss as a team to make progress label May 6, 2024
@breader124
Copy link

Hey @philwebb, is there any news on the topic?

@philwebb
Copy link
Member

philwebb commented May 8, 2024

@breader124 We discussed the issue and would like to do something in 3.4. We can't really start work on it until 3.3 is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants