Skip to content

Commit

Permalink
Ignore concurrently-deleted files when deleting by prefix from GCS
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeclaghorn committed Jul 30, 2018
1 parent 159e58f commit 362042c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion activestorage/lib/active_storage/service/gcs_service.rb
Expand Up @@ -61,7 +61,13 @@ def delete(key)

def delete_prefixed(prefix)
instrument :delete_prefixed, prefix: prefix do
bucket.files(prefix: prefix).all(&:delete)
bucket.files(prefix: prefix).all do |file|
begin
file.delete
rescue Google::Cloud::NotFoundError
# Ignore concurrently-deleted files
end
end
end
end

Expand Down

0 comments on commit 362042c

Please sign in to comment.