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

Reset file read offset before passing it to GoogleCloudStorage #481

Merged
merged 3 commits into from
Jul 16, 2018

Conversation

manufont
Copy link
Contributor

@manufont manufont commented Apr 12, 2018

Django's default FileSystemStorage uses File.chunks methods, that calls file.seek(0) on every file read.

Google cloud storage, however, uses file.read() (as seen here), which doesn't reset read offset.

This PR force read offset when passing the file to google cloud storage library, thus reducing the difference between these 2 storage implementations.

@manufont manufont changed the title Force file read offset to 0 Read offset is now set to 0 before GoogleCloudStorage reads it Force file read offset to 0 before giving it to GoogleCloudStorage Apr 12, 2018
@codecov-io
Copy link

codecov-io commented Apr 12, 2018

Codecov Report

Merging #481 into master will decrease coverage by 0.98%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #481      +/-   ##
==========================================
- Coverage    77.1%   76.12%   -0.99%     
==========================================
  Files          10       11       +1     
  Lines        1520     1579      +59     
==========================================
+ Hits         1172     1202      +30     
- Misses        348      377      +29
Impacted Files Coverage Δ
storages/backends/gcloud.py 94.82% <100%> (-0.12%) ⬇️
storages/backends/s3boto.py 87.45% <0%> (-1.25%) ⬇️
storages/backends/s3boto3.py 86.58% <0%> (-1.14%) ⬇️
storages/utils.py 96.87% <0%> (-0.1%) ⬇️
storages/backends/gs.py 69.73% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44997e7...1ca4c59. Read the comment docs.

@manufont manufont changed the title Force file read offset to 0 before giving it to GoogleCloudStorage Reset file read offset before passing it to GoogleCloudStorage Apr 12, 2018
@sww314 sww314 added the google label Jul 3, 2018
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.

3 participants