Fog::Storage::AWS::Files#length vs. #all.length

Beware thee calling the #length method on a Fog::Storage::AWS::Files object! It seems to include recently destroyed files!

Instead, you should use #all.length

# Includes destroyed files!!
Fog::Storage.new(my_connection).directories.get(my_directory).files.length

# Better!
Fog::Storage.new(my_connection).directories.get(my_directory).files.all.length

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.