Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix heavy assets failing to download on slow connections #6024

Merged
merged 8 commits into from
Dec 7, 2023

Conversation

D8H
Copy link
Collaborator

@D8H D8H commented Dec 6, 2023

Changes

  • Use a pool to limit concurrent downloads to 20.
  • Avoid 3D models used in different scenes to be downloaded several times

- Use a pool to limit concurrent downloads to 20.
- Avoid 3D models used in different scenes to be downloaded several times
@D8H D8H requested a review from 4ian as a code owner December 6, 2023 17:54
@D8H D8H changed the title Fix heavy assets failing to download on slow connections. Fix heavy assets failing to download on slow connections Dec 6, 2023
GDJS/Runtime/ResourceLoader.ts Outdated Show resolved Hide resolved
GDJS/Runtime/ResourceLoader.ts Outdated Show resolved Hide resolved
GDJS/Runtime/ResourceLoader.ts Outdated Show resolved Hide resolved
@@ -114,6 +114,9 @@ namespace gdjs {
if (!loader) {
return;
}
if (this._loadedThreeModels.getFromName(resource.name)) {
Copy link
Owner

Choose a reason for hiding this comment

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

Will this conflict with hot-reloading? The comment of the function says the contrary of what this line does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, the comment is wrong, hot-reload doesn't handle resources refresh and we'd likely clear cache to handle it.

GDJS/Runtime/ResourceLoader.ts Outdated Show resolved Hide resolved
GDJS/Runtime/ResourceLoader.ts Outdated Show resolved Hide resolved
const task = this._prioritizeScene(sceneName);
return new Promise<void>((resolve, reject) => {
if (!task) {
resolve();
return;
}
task.registerCallback(() => {
this._isLoadingInBackground = true;
Copy link
Owner

Choose a reason for hiding this comment

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

What if !task is true?

@D8H D8H merged commit ae96ebf into master Dec 7, 2023
4 of 6 checks passed
@D8H D8H deleted the fix-fast-loading-timeout branch December 7, 2023 14:36
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