Skip to content

fix: individual yml download limit#137

Open
Amigache wants to merge 5 commits intoEdgeTX:mainfrom
Amigache:fix/individual-yml-download-limit
Open

fix: individual yml download limit#137
Amigache wants to merge 5 commits intoEdgeTX:mainfrom
Amigache:fix/individual-yml-download-limit

Conversation

@Amigache
Copy link
Contributor

This pull request improves the backup download flow to address issues with downloading a large number of files simultaneously, and adds a test to ensure robust handling of bulk downloads. The main changes are grouped into improvements to the download logic and enhancements to test coverage.

Improvements to backup download logic:

  • Changed the file download process in BackupCreateFlow.tsx to download files sequentially with a delay, preventing Chromium's rapid download blocking when many files are downloaded at once. [1] [2]
  • Updated the download handler to use an asynchronous chain, ensuring that each file download is spaced out by 200ms.
  • Modified the promise handler to be asynchronous in order to support sequential downloading.

Test coverage enhancements:

  • Added a test in backup.spec.ts to verify that downloading a large number of models (e.g., 43) works correctly and all files are present and valid.

Bug reported on:
https://discord.com/channels/761870396085108757/854744834698379274/1481212834766655578

…nload limit

When downloading individual .yml backup files, all downloads were triggered
simultaneously via forEach + link.click(). Chromium blocks rapid programmatic
downloads after ~10, causing only model1* files to be saved.

Changed to sequential downloads with a 200ms delay between each file.
Added test verifying all 43 models are returned correctly.
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 35.69%. Comparing base (7433e52) to head (cfbd636).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
+ Coverage   34.95%   35.69%   +0.73%     
==========================================
  Files         115      115              
  Lines        4288     4281       -7     
  Branches     1033     1033              
==========================================
+ Hits         1499     1528      +29     
+ Misses       2585     2544      -41     
- Partials      204      209       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

As suggested in code review:
- Replace manual Blob/link DOM manipulation with legacyDownload (js-file-download)
- Use p-limit(5) for concurrency limiting instead of fully sequential reduce chain
- Use delay() utility from shared/tools instead of raw setTimeout
- Simplify test by mocking legacyDownload directly
freshollie
freshollie previously approved these changes Mar 16, 2026
Copy link
Collaborator

@freshollie freshollie left a comment

Choose a reason for hiding this comment

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

If you tested as working, feel free to merge

@Amigache
Copy link
Contributor Author

If you tested as working, feel free to merge

After several tests, I discovered that the batches weren't always running correctly. I've made a small change that seems to be effective; images attached.

image image

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