Skip to content

fix: Event handlers are not handled in multi pod scenario - #244

Merged
hopengfoong merged 1 commit into
release/4.8.1from
fix/event-handlers-not-firing
Jul 16, 2026
Merged

fix: Event handlers are not handled in multi pod scenario#244
hopengfoong merged 1 commit into
release/4.8.1from
fix/event-handlers-not-firing

Conversation

@hopengfoong

@hopengfoong hopengfoong commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

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"

image

Replica

image

New behaviour

The following two images shows that "web" cluedin-server handles it AND the server extra replica handles it too.

"Web"

image

Replica

image

How has it been tested?

Locally using homedev with CLUEDIN_SERVER_EXTRA_REPLICAS to 1

Release Note

Notable Changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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(...) to ApplicationContext.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
hopengfoong marked this pull request as ready for review July 16, 2026 03:48
@hopengfoong
hopengfoong requested a review from a team as a code owner July 16, 2026 03:48
@hopengfoong
hopengfoong enabled auto-merge (squash) July 16, 2026 04:47
@hopengfoong
hopengfoong merged commit 1cb0035 into release/4.8.1 Jul 16, 2026
3 checks passed
@hopengfoong
hopengfoong deleted the fix/event-handlers-not-firing branch July 16, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants