Skip to content

Commit

Permalink
fix: improve compressed download progress bars
Browse files Browse the repository at this point in the history
when downloading a large and extremely compressed file, user feedback would stop after we had received an uncompressed amount of data equal to the compressed size of the data.

Downloading the spansh galaxy data, for example, only transfers 1.5GB of data after compression, but the file itself expands to over 9GB, resulting in the progress bar sticking at 1.5GB and looking as though it has failed/hung.
  • Loading branch information
kfsone authored and eyeonus committed Apr 24, 2024
1 parent 3687a6b commit 1801216
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tradedangerous/transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def download(
raise TradeException(
"Remote server gave an empty response. Please try again later."
)

# if the file is being compressed by the server, the headers tell us the
# length of the compressed data, but in our loop below we will be receiving
# the uncompressed data, which should be larger, which will cause our
# download indicators to sit at 100% for a really long time if the file is
# heavily compressed and large (e.g spansh 1.5gb compressed vs 9GB uncompressed)
if encoding == "gzip" and length:
length *= 4

if tdenv.detail > 1:
if length:
Expand Down

0 comments on commit 1801216

Please sign in to comment.