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

Merged

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.

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
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.21, 1.5.22, 1.5.23 May 28, 2024
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.23, 1.5.24, 1.5.25 Jun 6, 2024
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.25, 1.5.26 Jun 14, 2024
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.26, 1.5.27 Jun 27, 2024
@Aaronontheweb Aaronontheweb merged commit 7fb0c2b into akkadotnet:dev Jul 11, 2024
12 checks passed
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.

2 participants