Skip to content

fix(gui-client): don't busy-loop when update checker is disabled - #9445

Merged
thomaseizinger merged 4 commits into
mainfrom
fix/gui-busy-loop
Jun 6, 2025
Merged

fix(gui-client): don't busy-loop when update checker is disabled#9445
thomaseizinger merged 4 commits into
mainfrom
fix/gui-busy-loop

Conversation

@thomaseizinger

Copy link
Copy Markdown
Member

The GUI client's update checker is a task that runs concurrently to the main event-loop of the client. When a new update is found, it sends a notification through a channel. When the update checker is disabled via MDM, this channel is instantly closed, resulting in None being read as part of the event-loop in the client.

Previously, we would then return Poll::Ready(EventloopTick::UpdateNotification(None)) and then simply ignore this event. This however is wrong. Returning Poll::Ready means that the future needs to be polled again, resulting in an effective busy-loop where we constantly emit the above event and then ignore it. Due to the priority order that was previously defined, this led to us never checking another channel: The one where we receive deep-links from 2nd GUI instances.

As a result, signing into the client when the update checker was disabled does not work and instead, the newly launched instance hangs because it can never send over the deep-link.

Resolves: #9420

@thomaseizinger
thomaseizinger requested review from Copilot and jamilbk June 6, 2025 08:52
@vercel

vercel Bot commented Jun 6, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
firezone ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 8:56am

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 prevents a busy-loop when the update checker is disabled by flattening the nested Option for update notifications and reprioritizing channels so new-instance deep-links are still handled.

  • Simplified UpdateNotification variant from Option<Option<...>> to Option<...>
  • Changed the event-loop from while let Some(...) to an infinite loop with a match on a non-optional tick
  • Reordered tick so NewInstanceLaunched is polled before update notifications
Comments suppressed due to low confidence (3)

rust/gui-client/src-tauri/src/controller.rs:396

  • [nitpick] Consider adding a comment here explaining that update notifications are intentionally deprioritized and that closing the updates channel should not cause a busy-loop.
if let Poll::Ready(Some(notification)) = self.updates_rx.poll_next_unpin(cx) {

rust/gui-client/src-tauri/src/controller.rs:297

  • Add a test case simulating the update-checker being disabled (updates_rx channel closed) to verify that the controller does not busy-loop and still processes deep-link events.
loop {

rust/gui-client/src-tauri/src/controller.rs:340

  • [nitpick] The name notification here represents an Option<updates::Notification>. For clarity, consider renaming it to maybe_notification or notification_opt.
EventloopTick::UpdateNotification(notification) => {

@thomaseizinger
thomaseizinger added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit b0d5941 Jun 6, 2025
@thomaseizinger
thomaseizinger deleted the fix/gui-busy-loop branch June 6, 2025 11:14
github-merge-queue Bot pushed a commit that referenced this pull request Jun 7, 2025
This timeout seems to be problematic as deep-links don't open with it at
all. This is a regression from #9445.
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.

Client broken on Windows with MDM

3 participants