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

Adds support to use MayInterleave with StatelessWorker grains #9050

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

ledjon-behluli
Copy link
Contributor

@ledjon-behluli ledjon-behluli commented Jun 30, 2024

Since MayInterleave predicate is handled as a component, and components are not allowed in SW grain context. Using MayInterleaveAttribute, orleans throws an exception as detailed here #9049 - It is understandable to not allow components to be registered with SW's, since they may interplay with the grain's state, and SW use-case is not to dealing with state.

I think the constraint can be relaxed here since the interleaving operation is determined on every message invocation, and the method that determines that is defined as static and is purely functional, there should not be any problems AFAIK.

Personally I would go with a custom thread-safe singleton, but I can understand people using StatelessWorker**(1)** as a means to have a single worker-per-silo that is inherently thread-safe due to Orleans' scheduler, yet still wanting the interleaving benefits.

Fixes #9049

Microsoft Reviewers: Open in CodeFlow

@ReubenBond ReubenBond merged commit 7328b28 into dotnet:main Jul 1, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stateless worker grains don't support reentrancy by predicate
2 participants