Last active
May 23, 2024 11:16
-
-
Save Snaipe/c66caab3d8acbc323d68e46ebe7ae953 to your computer and use it in GitHub Desktop.
purge Gitlab Dependency proxy blobs from the database if the corresponding local file is missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# purge Gitlab Dependency proxy blobs from the database if the corresponding local file is missing | |
DependencyProxy::Blob.where(file_store: [nil, ::DependencyProxy::FileUploader::Store::LOCAL]).find_in_batches do |batch| | |
batch.each { |blob| | |
begin | |
blob.open | |
rescue Errno::ENOENT => e | |
puts "Blob #{blob.id} corrupted, deleting" | |
blob.destroy | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment