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

Allow setting the chunk_size in Blob creation via the GS_BLOB_CHUNK_SIZE #401

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storages/backends/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, name, mode, storage):
self._storage = storage
self.blob = storage.bucket.get_blob(name)
if not self.blob and 'w' in mode:
self.blob = Blob(self.name, storage.bucket)
self.blob = Blob(self.name, storage.bucket, chunk_size=setting('GS_BLOB_CHUNK_SIZE', None))
self._file = None
self._is_dirty = False

Expand Down
2 changes: 1 addition & 1 deletion tests/test_gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_open_write(self, MockBlob):
self.storage._bucket.get_blob.return_value = None

f = self.storage.open(self.filename, 'wb')
MockBlob.assert_called_with(self.filename, self.storage._bucket)
MockBlob.assert_called_with(self.filename, self.storage._bucket, chunk_size=None)

f.write(data)
tmpfile = f._file
Expand Down