-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
service/s3/s3manager: adding cleanup function to batch objects #1375
Conversation
737efa6
to
d014570
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a side note It would also be really helpful to have an example_test.go file.
service/s3/s3manager/batch.go
Outdated
key, | ||
} | ||
} | ||
|
||
func (err *Error) Error() string { | ||
return err.OrigErr.Error() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful for the Error message to include the bucket and object key that the error failed on.
service/s3/s3manager/batch.go
Outdated
@@ -382,4 +396,6 @@ func (batcher *UploadObjectsIterator) UploadObject() BatchUploadObject { | |||
// BatchUploadObject contains all necessary information to run a batch operation once. | |||
type BatchUploadObject struct { | |||
Object *UploadInput | |||
// After will run after each iteration during the batch process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll clarify this statement to stay after the object has been attempted to be uploaded. Regardless of success/failure.
Same for the other After
functions
service/s3/s3manager/batch_test.go
Outdated
downloader := NewDownloaderWithClient(svc) | ||
deleter := NewBatchDeleteWithClient(svc) | ||
|
||
iter := &testAfterIter{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should create a new iterator for each test case to prevent pollution. Sharing the iterator value can hide or introduce bugs in the test.
service/s3/s3manager/batch_test.go
Outdated
} | ||
|
||
func (iter *testAfterIter) Next() bool { | ||
next := (iter.index & 1) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit this will only wouldn't this be similar to just do something like the following, or change from an index, to a boolean flag.
func (iter *testAfterIter) Next() bool {
defer func() { iter.index++ }
return iter.index == 0
}
d014570
to
30a00d3
Compare
No description provided.