Skip to content

refactor: use exponential backoff for dev server retry#5505

Open
Liumingxun wants to merge 2 commits into
wailsapp:masterfrom
Liumingxun:master
Open

refactor: use exponential backoff for dev server retry#5505
Liumingxun wants to merge 2 commits into
wailsapp:masterfrom
Liumingxun:master

Conversation

@Liumingxun
Copy link
Copy Markdown

  • Replace fixed 500ms sleep with exponential backoff (250ms base, 2× per attempt, capped at 5s).

  • This extends the total retry window beyond the original 5-second limit, giving slower-starting dev servers enough time to fully boot without being misjudged or prematurely killed.

Description

The previous preRun() implementation waited for the frontend dev server with a fixed ceiling. This PR replaces the fixed sleep with exponential backoff,

Fixes #5504

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux
wails3 doctor
Details # System

┌─────────────────────────────────────────────────────────────┐
| Name | Arch Linux |
| Version | Unknown |
| ID | arch |
| Branding | |
| Platform | linux |
| Architecture | amd64 |
| Desktop Environment | unset |
| NVIDIA Driver | N/A |
| XDG_SESSION_TYPE | unset |
| CPU | AMD Ryzen AI 5 PRO 340 w/ Radeon 840M |
| Memory | 9GB |
└─────────────────────────────────────────────────────────────┘

Build Environment

┌──────────────────────────────────────────────────────────────────────┐
| Wails CLI | v3.0.0-alpha.95 |
| Go Version | go1.26.3 |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| DefaultGODEBUG | cryptocustomrand=1,tlssecpmlkem=0,urlstrictcolons=0 |
| GOAMD64 | v1 |
| GOARCH | amd64 |
| GOOS | linux |
└──────────────────────────────────────────────────────────────────────┘

Dependencies

┌─────────────────────────────────────────────────────────────────────────────────────────────┐
| npm | 11.15.0 |
| pkg-config | 2.5.1-1 |
| webkit2gtk (legacy) | [Optional] not installed. Install with: sudo pacman -S webkit2gtk-4.1 |
| webkitgtk-6.0 | 2.52.3-1 |
| gcc | 16.1.1+r12+g301eb08fa2c5-1 |
| gtk3 (legacy) | 1:3.24.52-1 |
| gtk4 | 1:4.22.4-1 |
| docker | *Not installed (optional - for cross-compilation) |
| |
└────────────────────────────────── * - Optional Dependency ──────────────────────────────────┘

Checking for issues

SUCCESS No issues found

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • (v2 only) I have updated website/src/pages/changelog.mdx with details of this PR (v3 changelog entries are added automatically)
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

- Replace fixed 500ms sleep with exponential backoff
(250ms base, 2× per attempt, capped at 5s).

- This extends the total retry window beyond the original
 5-second limit, giving slower-starting dev servers enough
 time to fully boot without being misjudged or prematurely killed.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@einsy-dev
Copy link
Copy Markdown

I just changed 500 to 5000 and fixed the startup issue. At least, it seems so. Thanks for the solution

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.

[v3,DX] use exponential backoff when waiting for frontend dev server to start

2 participants