fix: Event handlers are not handled in multi pod scenario - #244
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates FileStorage connector event handlers to subscribe to the system-wide async event bus instead of the local-only event bus, so events are handled correctly when the connector runs with multiple pods/replicas.
Changes:
- Switched stream-related event handlers from
ApplicationContext.System.Events.Local.Subscribe(...)toApplicationContext.System.Events.SubscribeAsync(...). - Removed sync wrapper methods that blocked on async work via
GetAwaiter().GetResult().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Connector.FileStorage.Common/EventHandlers/UpdateStreamEventHandler.cs | Uses async system event subscription to receive stream update events across pods. |
| src/Connector.FileStorage.Common/EventHandlers/UpdateExportTargetEventHandler.cs | Uses async system event subscription to receive export target updates across pods. |
| src/Connector.FileStorage.Common/EventHandlers/ChangeStreamStateEventHandler.cs | Uses async system event subscription to receive stream state changes across pods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hopengfoong
marked this pull request as ready for review
July 16, 2026 03:48
hopengfoong
enabled auto-merge (squash)
July 16, 2026 04:47
andrew-hardy
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Work Item ID: AB#58005
In multi pod scenario, when stream or export target state is changed, events are fired. Before this PR, the events are only handled in the "web" cluedin-server. However, it DOES NOT affect the functionality because replica's scheduler checks if the export should be run every minute. This PR is to ensure that the jobs are "removed" immediately rather than waiting for scheduler to run & then NOT add the "export job" and waiting for the export job to "exit" if it's triggered
Existing behaviour
The following two images shows that "web" cluedin-server handles it but the extra replica does not when stream is stopped
"Web"
Replica
New behaviour
The following two images shows that "web" cluedin-server handles it AND the server extra replica handles it too.
"Web"
Replica
How has it been tested?
Locally using homedev with CLUEDIN_SERVER_EXTRA_REPLICAS to 1
Release Note
Notable Changes