Quartz.NET 4.0 ValueTask reasons behind
Pre-flight checks
- I have searched open and closed issues and could not find a duplicate.
- I have checked the documentation.
- I can reproduce this against the latest 4.x or 3.x release of Quartz.NET.
Describe the bug
Hello!
Congrats for making quartz.net active again.
I've seen v4 uses ValueTask instead of the Task for the IJob interface and while I searched, I could not find what was the reason behind this change
I am open this bug just to understand the reasons behind, and with the potential to make it clear in the v4 migration the reasons behind - to help others understand as well (since it's a breaking change)
So first I assume that all the implementations of the IJob will be asynchronously because that's the purpose of the Job - to execute background task. Hence because of this, the methods will never complete synchronously.
Now in case this would happen, using a ValueTask can help with the state machine optimization, but here it will none. Moreover it will require extra heap alocations for the state machine to copy the value task.
I will leave the ValueTask remarks just for reference https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1?view=net-10.0#remarks , but is there any reason why this modification has been done ? Benchmark, metrics ?
Regards,
Steps to reproduce
Using v4
Expected behavior
I would expect to use Task like previous
Actual behavior
Nothing
Code sample
Exception / stack trace
Quartz configuration
Quartz.NET line
4.x
Quartz.NET version
4,0
.NET version
net10.0
Job store
RAMJobStore (in-memory)
Serializer
System.Text.Json (the default)
Clustering
No — single scheduler node
Hosting / integration
- Quartz (AddQuartz / AddQuartzHostedService / the health check)
- Quartz.AspNetCore (the HTTP API)
- Quartz.Dashboard
- Quartz.Aspire
- Quartz.HttpClient
- Plain console / manually managed scheduler
Operating system
None
Regression?
No response
Additional context
No response
Source: quartznet/quartznet