Skip to content

Conversation

@kylejuliandev
Copy link
Contributor

@kylejuliandev kylejuliandev commented Dec 13, 2025

This PR

Shortly after #515 was merged I realised that the approach I had taken had more explicitly coupled the Provider and Resolver to one another. By using an event we can subscribe and unsubscribe when necessary in the Provider. The state transitions are still being executed sychonrously on the same thread, so the behaviour should be unchanged, but hopefully this clean up the code and keeps a separation of concerns.

Related Issues

Notes

Follow-up Tasks

How to test

* This will decouple the resolver and provider and ensure it happens
  asynchronously

Signed-off-by: Kyle Julian <[email protected]>
@kylejuliandev kylejuliandev added the provider:flagd Issues related to provider flagd label Dec 13, 2025
@gemini-code-assist

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

@kylejuliandev kylejuliandev changed the title refactor: Asychronously publish events when handling Flagd Resolver state changes refactor: Decouple event publishing from Flagd Resolver when state changes Dec 13, 2025
@kylejuliandev
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the communication between FlagdProvider and the Resolver implementations to use a standard event-based pattern instead of passing callbacks in constructors. This effectively decouples the components, improving maintainability and adhering to good design principles. The changes are well-executed:

  • The Resolver interface and its implementations (InProcessResolver, RpcResolver) now expose a ProviderEvent.
  • FlagdProvider subscribes to this event upon initialization and correctly unsubscribes during shutdown to prevent potential memory leaks.
  • Compatibility with .NET Framework is preserved by conditionally having FlagdProviderEvent inherit from EventArgs.
  • All associated tests have been updated to reflect these changes.

The refactoring is clean and improves the overall code structure. I have not found any issues of medium or higher severity.

@kylejuliandev kylejuliandev marked this pull request as ready for review December 13, 2025 12:07
@kylejuliandev kylejuliandev requested review from a team as code owners December 13, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:flagd Issues related to provider flagd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants