-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Akka.Actor: make ITimeProvider injectable into consuming classes
#7314
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
Akka.Actor: make ITimeProvider injectable into consuming classes
#7314
Conversation
All of this functionality was duplicated on the `IScheduler` anyway - so removing this makes it possible to actually inject the `ITimeProvider` into downstream dependencies using the `ActorSystem`
Aaronontheweb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detailed my changes
| /// TBD | ||
| /// </summary> | ||
|
|
||
| public static DateTimeOffsetNowTimeProvider Instance { get; } = new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, I removed all references to this type (all of which were contained inside Akka.Delivery and Akka.Cluster.Sharding.Delivery) and preferred to use the IScheduler's implementation of these same methods instead, which are identical on the HashedWheelTimer base class.
| public CoordinatedShutdownExtension() { } | ||
| public override Akka.Actor.CoordinatedShutdown CreateExtension(Akka.Actor.ExtendedActorSystem system) { } | ||
| } | ||
| [System.ObsoleteAttribute("This class will be removed in Akka.NET v1.6.0 - use the IScheduler instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marked the DateTimeNowTimeProvider as Obsolete and slated for removal in v1.6.
Arkatufus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Removes dependencies on the static
DateTimeNowTimeProviderand instead has everything use theISchedulerinstead, which provides the exact same functionality with identical implementations. This makes it possible to inject theITimeProviderusing theActorSystem's configuration instead.This should enable us to be able to support .NET 8's
TimeProvidermore easily in the future for testing purposes.Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):