Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(site): reduce fetch interval on workspaces page#18725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 5 commits intomainfromcj/site/reduce-workspaces-fetch-interval
Jul 8, 2025

Conversation

johnstcn
Copy link
Member

Relates tocoder/internal#720

The workspaces query fetches alot of information. We can probably reduce the frequency at which we fetch data by polling less often if no workspace builds are in 'intermediate' states.

@johnstcnjohnstcn requested a review froma teamJuly 2, 2025 17:34
@johnstcnjohnstcn self-assigned thisJul 2, 2025
@johnstcnjohnstcn requested review fromjaaydenh and removed request fora teamJuly 2, 2025 17:34
@johnstcnjohnstcn requested a review fromCopilotJuly 3, 2025 16:06
Copy link
Contributor

@CopilotCopilotAI left a comment

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 reduces the polling frequency on the Workspaces page by dynamically adjusting the refetch interval:

  • Polls every 5s when any workspace build is in an intermediate state, otherwise every 30s.
  • Disables polling on errors and when the tab is inactive.
Comments suppressed due to low confidence (2)

site/src/pages/WorkspacesPage/WorkspacesPage.tsx:80

  • [nitpick] Consider adding unit or integration tests to verify that the polling interval switches correctly based on error states and active build presence.
refetchInterval: ({ state }) => {

site/src/pages/WorkspacesPage/WorkspacesPage.tsx:85

  • workspace.latest_build may be undefined, causing runtime errors; use optional chaining (e.g.,workspace.latest_build?.status) or provide a default value to guard against missing builds.
const status = workspace.latest_build.status;

@johnstcnjohnstcn requested review froma team andKira-Pilot and removed request forjaaydenh,a team andKira-PilotJuly 7, 2025 10:19
Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

seems legit

?ACTIVE_BUILDS_REFRESH_INTERVAL
:NO_ACTIVE_BUILDS_REFRESH_INTERVAL;
},
refetchOnWindowFocus:"always",
Copy link
MemberAuthor

@johnstcnjohnstcnJul 8, 2025
edited
Loading

Choose a reason for hiding this comment

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

review:refetchInterval does not execute while the tab is in the background, so the reduced refresh interval is more noticeable if you switch to a different tab and then switch back. AddingrefetchOnWindowFocus here seems like a good way to ensure that a user sees fresh data sooner. Alternatively, we could setrefetchIntervalInBackground but we then have to reason about two separate refresh loops. It also means that background Coder tabs will poll continuously, which does not seem desirable.

@johnstcnjohnstcn merged commit1195f31 intomainJul 8, 2025
26 of 28 checks passed
@johnstcnjohnstcn deleted the cj/site/reduce-workspaces-fetch-interval branchJuly 8, 2025 10:00
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@EmyrkEmyrkEmyrk left review comments

Copilot code reviewCopilotCopilot left review comments

@aslilacaslilacaslilac approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@aslilac@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp