Skip to content

[browser] Allow download retry+throttling in unified code with blazor - #88910

Merged
maraf merged 20 commits into
dotnet:mainfrom
maraf:WasmDownloadRetryForSdk
Jul 20, 2023
Merged

[browser] Allow download retry+throttling in unified code with blazor#88910
maraf merged 20 commits into
dotnet:mainfrom
maraf:WasmDownloadRetryForSdk

Conversation

@maraf

@maraf maraf commented Jul 14, 2023

Copy link
Copy Markdown
Member
  • Allow download retry+throttling in unified code with blazor
  • Fix advanced sample
  • Add WBT checking for download resource counters (onDownloadResourceProgress)
  • Export type DotnetHostBuilder (unrelated, used in blazor)

@maraf maraf added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Jul 14, 2023
@maraf maraf added this to the 8.0.0 milestone Jul 14, 2023
@maraf maraf self-assigned this Jul 14, 2023
@ghost

ghost commented Jul 14, 2023

Copy link
Copy Markdown

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details
  • Allow download retry+throttling in unified code with blazor
  • Fix advanced sample
  • Add WBT checking for donwload resource counters (onDownloadResourceProgress)
Author: maraf
Assignees: maraf
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript, os-browser

Milestone: 8.0.0

@maraf
maraf marked this pull request as ready for review July 14, 2023 19:56
Comment thread src/mono/wasm/runtime/dotnet.d.ts
@radical

radical commented Jul 14, 2023

Copy link
Copy Markdown
Member

Does this fix the issue seen in #88505 (comment) ?
cc @pavelsavara

Comment thread src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/DownloadResourceProgressTests.cs Outdated
Comment thread src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/DownloadResourceProgressTests.cs Outdated
@maraf

maraf commented Jul 14, 2023

Copy link
Copy Markdown
Member Author

Does this fix the issue seen in #88505 (comment) ?

Yes, it does

@radical

radical commented Jul 14, 2023

Copy link
Copy Markdown
Member

Does this fix the issue seen in #88505 (comment) ?

Yes, it does

Would it be possible to add some test to check that?

@maraf

maraf commented Jul 14, 2023

Copy link
Copy Markdown
Member Author

Does this fix the issue seen in #88505 (comment) ?

Yes, it does

Would it be possible to add some test to check that?

That is the case with fetchFailure=true, when the custom loader throws error when fetching resource.

Comment thread src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/DownloadResourceProgressTests.cs Outdated
Comment thread src/mono/wasm/testassets/WasmBasicTestApp/wwwroot/main.js
@maraf
maraf requested a review from radical July 19, 2023 10:10
@maraf

maraf commented Jul 19, 2023

Copy link
Copy Markdown
Member Author

Failures are unrelated

testOutput("Throw error instead of downloading resource");
const error = new Error("Simulating a failed fetch");
error.silent = true;
throw error;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this get surfaced to the user at all? What behavior does blazor have when we fail to load an assembly at all?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Before this PR, the Blazor aborts on first download failure. Their original approach was to let the user override loadBootResource do retries by themself. After discussion with @pavelsavara we agreed that turn-on our built-in retry support.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I meant, is this surfaced when even a 3rd retry fails?

Comment thread src/mono/wasm/testassets/WasmBasicTestApp/wwwroot/main.js
Comment thread src/mono/wasm/runtime/loader/assets.ts
[Theory]
[InlineData(false)]
[InlineData(true)]
public async Task DownloadProgressFinishes(bool failAssemblyDownload)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe rename to indicate that this is testing retries.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

(intended) Retry happens only when failAssemblyDownload=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, and that's what we are testing here :)

@maraf maraf Jul 21, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We are testing "download progress" counter, one case is with retry and one is without

@maraf
maraf merged commit 1aafc6f into dotnet:main Jul 20, 2023
@maraf
maraf deleted the WasmDownloadRetryForSdk branch July 20, 2023 12:51
@ghost ghost locked as resolved and limited conversation to collaborators Aug 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants