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 6ad4a0e commit f1107ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion activestorage/lib/active_storage/service/gcs_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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 f1107ac

Please sign in to comment.