Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

make client.downloader to download large file to file #57

Closed
wants to merge 1 commit into from

Conversation

mayli
Copy link
Contributor

@mayli mayli commented Feb 7, 2017

#56 The current implementation will download the whole file into memory and
will crash when the file is too large.

This patch will fix this issue by:

  • download larger file (>4M) to a temp file on disk,
    and rename it to self.filename on self._write_to_file()
  • download smaller file to memory, but to a list of blocks
    the self.file_binary_data += block has performace issue
  • do checksuming while downloading,
    most CPU can calculate the checksum faster than download speed,
    this saves a full reading from disk for larger files

The current implementation will download the whole file into memory and
will crash when the file is too large.

This patch will fix this issue by:
 - download larger file (>4M) to a temp file on disk,
   and rename it to `self.filename` on `self._write_to_file()`
 - download smaller file to memory, but to a list of blocks
   the `self.file_binary_data += block` has performace issue
 - do checksuming while downloading,
   most CPU can calculate the checksum faster than download speed,
   this saves a full reading from disk for larger files
@coveralls
Copy link

coveralls commented Feb 7, 2017

Coverage Status

Coverage decreased (-0.09%) to 76.818% when pulling d1d79a2 on mayli:master into 05bad45 on JMSwag:master.

@mayli
Copy link
Contributor Author

mayli commented Feb 7, 2017

:/ py33 py34, and coverage :/

Will fix them.

@mayli mayli closed this Feb 8, 2017
@JMSwag
Copy link
Member

JMSwag commented Feb 8, 2017

@mayli Those tests fail randomly. I'll add a few retries to the tests.

@JMSwag
Copy link
Member

JMSwag commented Feb 8, 2017

@mayli Also, thanks for the PR. It's dope!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants