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

Add ActorBase lifecycle flow unit tests #7128

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Arkatufus
Copy link
Contributor

Changes

  • Add new property ActiveTimers to ITimerScheduler to retrieve all currently active timer keys
  • Adds ActorBase lifecycle flow unit tests in relation to IWithTimers lifecycle

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to make the read operation zero-allocation.

/// <summary>
/// Retrieves all current active timer keys
/// </summary>
public ImmutableArray<object> ActiveTimers => _timers.Keys.ToImmutableArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just return an ICollection<object> or whatever here so we don't have to allocate an immutable array each time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this is probably done for the purposes of making sure we don't get rugged by the collection changing out from under us, but it's better to take that risk and leave the API un-opionated

Copy link
Contributor Author

@Arkatufus Arkatufus Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, though accessing _timers.Keys actually allocates internally inside the Dictionary, but that's unavoidable.

…rkatufus/akka.net into Add_ActorBase_Lifecycle_flow_assertion
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) March 22, 2024 14:38
@Aaronontheweb Aaronontheweb added this to the 1.5.19 milestone Mar 22, 2024
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.19, 1.5.20 Apr 15, 2024
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.20, 1.5.21 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants