Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2018-10-30 13:56:47 +0300
committerToon Claes <toon@gitlab.com>2018-11-07 13:29:31 +0300
commit149b63272202d78566af59db192c668a8803c910 (patch)
treeab3435679615c963cf2836131037b21e868d114d /app/models/upload.rb
parent1c481b7aacdc7e90d0f349dc8e848adaf0813c65 (diff)
Backport changes from EE
Now the files are identical again compared to EE. These are backported from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5050
Diffstat (limited to 'app/models/upload.rb')
-rw-r--r--app/models/upload.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/upload.rb b/app/models/upload.rb
index a6af7a8b869..e01e9c6a4f0 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -12,6 +12,7 @@ class Upload < ActiveRecord::Base
validates :uploader, presence: true
scope :with_files_stored_locally, -> { where(store: ObjectStorage::Store::LOCAL) }
+ scope :with_files_stored_remotely, -> { where(store: ObjectStorage::Store::REMOTE) }
before_save :calculate_checksum!, if: :foreground_checksummable?
after_commit :schedule_checksum, if: :checksummable?
@@ -46,7 +47,18 @@ class Upload < ActiveRecord::Base
end
def exist?
- File.exist?(absolute_path)
+ exist = File.exist?(absolute_path)
+
+ # Help sysadmins find missing upload files
+ if persisted? && !exist
+ if Gitlab::Sentry.enabled?
+ Raven.capture_message("Upload file does not exist", extra: self.attributes)
+ end
+
+ Gitlab::Metrics.counter(:upload_file_does_not_exist_total, 'The number of times an upload record could not find its file').increment
+ end
+
+ exist
end
def uploader_context