Skip to content

Comments

fix(bug): use stream when downloading snapshot locally#223

Merged
KeiKey merged 2 commits intomainfrom
bug/98035-large-snapshot-fail-download
May 12, 2025
Merged

fix(bug): use stream when downloading snapshot locally#223
KeiKey merged 2 commits intomainfrom
bug/98035-large-snapshot-fail-download

Conversation

@KeiKey
Copy link
Contributor

@KeiKey KeiKey commented Apr 17, 2025

This PR is about fixing the issue where large snapshot couldn't be downloaded via CLI. In order to fix it streams are used.

How to test it:

  1. Update the "max old space size" memory restriction option in your terminal when running the command. Side note, --max-semi-space-size applies only to the current terminal session and resets when a new terminal is opened.
  2. Update the download link with the link of a really big file. I used a link from ipv4.download.thinkbroadband.com but you are free to use any other link: http://ipv4.download.thinkbroadband.com/5GB.zip. Side note, if you follow this method it will take some time to download.

@KeiKey KeiKey requested a review from a team April 17, 2025 07:30
@dcxn dcxn requested review from gamer496, kcog and pedily April 17, 2025 09:42
gamer496
gamer496 previously approved these changes Apr 30, 2025
@dcxn dcxn requested a review from mhdha94 May 5, 2025 13:08
@mhdha94
Copy link
Contributor

mhdha94 commented May 5, 2025

Hello @KeiKey I tested your changes and they worked fine. but I noticed something, I can see the success message is displayed before the download has actually completed.

[success] Created Snapshot test and downloaded it to ./agent/snapshots/test.csnap - Enjoy.

I think we need to wait until the download is fully complete before showing that message

@KeiKey
Copy link
Contributor Author

KeiKey commented May 9, 2025

Hello @KeiKey I tested your changes and they worked fine. but I noticed something, I can see the success message is displayed before the download has actually completed.

[success] Created Snapshot test and downloaded it to ./agent/snapshots/test.csnap - Enjoy.

I think we need to wait until the download is fully complete before showing that message

I checked it and the message is printed after creating the Snapshot. More than likely what you noticed was a visual issue. Since it was a big file, it took some time in order for the file to show in the IDE/code editor.

@mhdha94
Copy link
Contributor

mhdha94 commented May 9, 2025

Hello @KeiKey I tested your changes and they worked fine. but I noticed something, I can see the success message is displayed before the download has actually completed.

[success] Created Snapshot test and downloaded it to ./agent/snapshots/test.csnap - Enjoy.

I think we need to wait until the download is fully complete before showing that message

I checked it and the message is printed after creating the Snapshot. More than likely what you noticed was a visual issue. Since it was a big file, it took some time in order for the file to show in the IDE/code editor.

Thanks @KeiKey ,I don’t think the issue is related to the size of the snapshot file. In this case, we’re using streams, which are asynchronous operations.

We need to wait until the download is fully completed before continuing. Currently, we're returning without waiting for the final result, so it might fail later. yet we still show that the snapshot was created successfully

@KeiKey
Copy link
Contributor Author

KeiKey commented May 9, 2025

Hello @KeiKey I tested your changes and they worked fine. but I noticed something, I can see the success message is displayed before the download has actually completed.

[success] Created Snapshot test and downloaded it to ./agent/snapshots/test.csnap - Enjoy.

I think we need to wait until the download is fully complete before showing that message

I checked it and the message is printed after creating the Snapshot. More than likely what you noticed was a visual issue. Since it was a big file, it took some time in order for the file to show in the IDE/code editor.

Thanks @KeiKey ,I don’t think the issue is related to the size of the snapshot file. In this case, we’re using streams, which are asynchronous operations.

We need to wait until the download is fully completed before continuing. Currently, we're returning without waiting for the final result, so it might fail later. yet we still show that the snapshot was created successfully

Updated accordingly. Thank you!

@KeiKey KeiKey requested a review from gamer496 May 9, 2025 13:46
@KeiKey KeiKey merged commit 0202cfb into main May 12, 2025
3 checks passed
@XavierJordaMurria
Copy link
Collaborator

🎉 This PR is included in version 1.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants