Skip to content

Force update on device connects to avoid potential cross-instance races#639

Draft
Page- wants to merge 1 commit into
masterfrom
fix-race
Draft

Force update on device connects to avoid potential cross-instance races#639
Page- wants to merge 1 commit into
masterfrom
fix-race

Conversation

@Page-

@Page- Page- commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

This can avoid a case where the device is connected to instance A, then connects to instance B without instance A observing the disconnect yet, then reconnecting to instance A whilst still being "owned" by instance B so we must always trigger the connect event to ensure instance A takes back ownership if necessary

Change-type: patch

https://balena.fibery.io/Inputs/Pattern/257

This can avoid a case where the device is connected to instance A, then
connects to instance B without instance A observing the disconnect yet,
then reconnecting to instance A whilst still being "owned" by instance
B so we must always trigger the connect event to ensure instance A
takes back ownership if necessary

Change-type: patch
@Page-
Page- requested a review from a team January 9, 2026 16:19

@thgreasi thgreasi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❤️

Comment thread src/app.ts
clusterWorker.send('toggleVerbosity');
}
});
if (cluster.workers == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would actually feel slghtly nicer if we had the same if (cluster.workers != null) { for (...) {...} } form in both events :)

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.

2 participants