8000 fix: static accepter image load fail by KuznetsovRoman · Pull Request #654 · gemini-testing/html-reporter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: static accepter image load fail #654

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

KuznetsovRoman
Copy link
Member

No description provided.

Copy link
pkg-pr-new bot commented Apr 18, 2025

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/html-reporter@654

commit: 8d47962

@@ -83,13 +84,19 @@ export const staticAccepterCommitScreenshot = (
payload.append('meta', JSON.stringify(meta));
}

await Promise.all(imagesInfo.map(async (imageInfo, index) => {
dispatch({type: actionNames.UPDATE_LOADING_TITLE, payload: `Preparing images to commit: ${index + 1} of ${imagesInfo.length}`});
const queue = new PQueue({concurrency: 256});
Copy link
Member Author

Choose a reason for hiding this comment

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

Now we limit number of image load requests by 256.
Looks like every browser can handle 256 requests at the same time, and this number seems reasonable as http/2 supports this amount.

But if there are too many requests, browser can have some difficulties

Copy link
Member

Choose a reason for hiding this comment

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

if this works then ok, but if 256 is the max value in most browsers, maybe it's worth limiting it slightly below the limit to preserve room for other, unrelated to images uploading requests? For example, so that when user is uploading images, he could still use report (including downloading time travel snapshots or downloading screenshots for other tests).

Copy link
Member Author

Choose a reason for hiding this comment

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

256 is just "how much request can you typically perform at the same time with http 2"
Browser would be fine with numbers above it, while it is not above 1k

}));
payload.append('image', blob, imagesInfo[i].path);

dispatch({type: actionNames.UPDATE_LOADING_TITLE, payload: `Preparing images to commit: ${i + 1} of ${imagesInfo.length}`});
Copy link
Member Author

Choose a reason for hiding this comment

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

dispatching this action after the blob is downloaded seems more suitable.

Example: we have 256 images.

Before:

We instantly dispatch 256 actions and user sees "preparing to commit: 256/256" (and only after we only start downloading these images)

After:

We update the counter after download is complete. So at start user will see "0/256" while nothing was downloaded

export function getBlob(url) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
export async function getBlobWithRetires(url, retriesCount = 3) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We can also be rps limited
So exponential retries (1s, 2s, 4s) would not be superfluous

Copy link
Member
@shadowusr shadowusr left a comment

Choose a reason for hiding this comment

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

Awesome enhancement! 🔥

@@ -83,13 +84,19 @@ export const staticAccepterCommitScreenshot = (
payload.append('meta', JSON.stringify(meta));
}

await Promise.all(imagesInfo.map(async (imageInfo, index) => {
dispatch({type: actionNames.UPDATE_LOADING_TITLE, payload: `Preparing images to commit: ${index + 1} of ${imagesInfo.length}`});
const queue = new PQueue({concurrency: 256});
Copy link
Member

Choose a reason for hiding this comment

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

if this works then ok, but if 256 is the max value in most browsers, maybe it's worth limiting it slightly below the limit to preserve room for other, unrelated to images uploading requests? For example, so that when user is uploading images, he could still use report (including downloading time travel snapshots or downloading screenshots for other tests).

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-490.static_accepter_load_images branch from f420a3b to 8d47962 Compare May 5, 2025 01:42
@KuznetsovRoman KuznetsovRoman merged commit 33a9b15 into master May 5, 2025
4 of 5 checks passed
@KuznetsovRoman KuznetsovRoman deleted the TESTPLANE-490.static_accepter_load_images branch May 5, 2025 01:45
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
0