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

Fix double invocation of progress callbacks #133

Merged
merged 1 commit into from
Jun 16, 2015
Merged

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Jun 15, 2015

Fixes #98.

This works by registering two handlers to disable/re-enable
callbacks during the request-created event handling. So
for signature version 4, you now have::

* request-created:
     - disable_callbacks() (via register_first())
     - client._sign_request()  (via register())
     - enable_callbacks()  (via register_last())

Added an integration test for this because the crux of this
working is because of the coordination of the event system
with the disabling/enabling of callbacks.

This will require a corresponding fix in botocore as well. (boto/botocore#560)

cc @kyleknap @mtdowling

@@ -362,6 +388,7 @@ def _upload_parts(self, upload_id, filename, bucket, key, callback,
num_parts = int(
math.ceil(self._os.get_file_size(filename) / float(part_size)))
max_workers = self._config.max_concurrency
max_workers = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, will remove.

@kyleknap
Copy link
Contributor

Looks good to me. I had a comment though about a line that looks like should have been deleted. 🚢

Fixes boto#98.

This works by registering two handlers to disable/re-enable
callbacks during the request-created event handling.  So
for signature version 4, you now have::

    * request-created:
         - disable_callbacks() (via register_first())
         - client._sign_request()  (via register())
         - enable_callbacks()  (via register_last())

Added an integration test for this because the crux of this
working is because of the coordination of the event system
with the disabling/enabling of callbacks.

This will require a corresponding fix in botocore as well.
@jamesls jamesls merged commit 1c8849c into boto:develop Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3Transfer.upload_file calls callback twice
2 participants