Skip to content

Use abort timeout for github latest-release fetch#3074

Merged
nightnei merged 1 commit intotrunkfrom
limitGithubApiRequestsTime
Apr 14, 2026
Merged

Use abort timeout for github latest-release fetch#3074
nightnei merged 1 commit intotrunkfrom
limitGithubApiRequestsTime

Conversation

@nightnei
Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Assisted with the investigation. The approach is my decision.

Proposed Changes

During the issue I faced that sometimes requests can hang for a long time and it freezes site creation flow.
To avoid long-hanging requests, I am adding a 5 seconds timeout to abort them.

Testing Instructions

  1. Apply the next diff:
diff --git a/apps/cli/lib/dependency-management/setup.ts b/apps/cli/lib/dependency-management/setup.ts
index 493772c5..789ea511 100644
--- a/apps/cli/lib/dependency-management/setup.ts
+++ b/apps/cli/lib/dependency-management/setup.ts
@@ -269,7 +269,8 @@ export async function updateServerFiles() {
                [ 'WP-CLI', updateLatestWpCliVersion ],
                [ 'SQLite integration', updateLatestSqliteCommandVersion ],
        ];
-
+       const startedAt = performance.now();
+       console.log('started', startedAt);
        await Promise.all(
                steps.map( ( [ name, step ] ) =>
                        step().catch( ( error ) => {
@@ -277,4 +278,6 @@ export async function updateServerFiles() {
                        } )
                )
        );
+       console.log('ended', performance.now() - startedAt);
 }
  1. Add 10.0.0.0 api.github.com to hosts
  2. Run Studio
  3. Create a site
  4. Look at terminal and assert that you see ended ~5043.083166

@nightnei nightnei requested a review from wojtekn April 13, 2026 13:38
@nightnei nightnei self-assigned this Apr 13, 2026
@nightnei nightnei requested a review from a team April 13, 2026 13:41
Copy link
Copy Markdown
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @nightnei! This looks good and works as described. 👍

Image

@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 24f35b9 vs trunk

app-size

Metric trunk 24f35b9 Diff Change
App Size (Mac) 1286.18 MB 1286.16 MB 0.01 MB ⚪ 0.0%

site-editor

Metric trunk 24f35b9 Diff Change
load 1882 ms 1875 ms 7 ms ⚪ 0.0%

site-startup

Metric trunk 24f35b9 Diff Change
siteCreation 9151 ms 9124 ms 27 ms ⚪ 0.0%
siteStartup 4948 ms 4942 ms 6 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@nightnei nightnei merged commit 4f20b53 into trunk Apr 14, 2026
10 checks passed
@nightnei nightnei deleted the limitGithubApiRequestsTime branch April 14, 2026 08:41
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.

3 participants