gradle-s3-build-cache
gradle-s3-build-cache copied to clipboard
Avoid doesObjectExist to make the retrieval faster
https://github.com/myniva/gradle-s3-build-cache/blob/0e22597934a682786096599f270724183e1f110c/src/main/java/ch/myniva/gradle/caching/s3/internal/AwsS3BuildCacheService.java#L64
I guess the implementation can use getObject
API to tell if the object exists or not.
Can you please share more information about this issue? In which situations do you encounter performance issues regarding retrieval of cache objects? Have you run any performance tests?
I assume that AmazonS3#getObject
would just throw an AmazonServiceException
if the object does not exist. So I am not sure if that would make the code more reliable.
@myniva , doesObjectExist
is a separate request which goes over the internet.
So if the same thing is implemented as a single network call, then it should be faster.
Note: AmazonServiceException
is still possible (e.g. 403 forbidden
), so the code has to account for it anyway.
Good point. So we would just need to distinct between 404 and other errors in the exception handling.