summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-11-24 15:07:44 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-12-01 13:36:06 +0100
commit6b4d33566f5f434cc86381a4a1347e42bbe348ee (patch)
tree441ea1ec210bbef063ec82d470b8e86d38ffec8c /app/models/commit.rb
parente91afc0dc071f2cb2dde54b12c04bb90d2c65f7b (diff)
downloadgitlab-ce-6b4d33566f5f434cc86381a4a1347e42bbe348ee.tar.gz
Pass commit data to ProcessCommitWorkerprocess-commit-worker-improvements
By passing commit data to this worker we remove the need for querying the Git repository for every job. This in turn reduces the time spent processing each job. The migration included migrates jobs from the old format to the new format. For this to work properly it requires downtime as otherwise workers may start producing errors until they're using a newer version of the worker code.
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 9e7fde9503d..176c524cf7b 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -48,6 +48,10 @@ class Commit
max_lines: DIFF_HARD_LIMIT_LINES,
}
end
+
+ def from_hash(hash, project)
+ new(Gitlab::Git::Commit.new(hash), project)
+ end
end
attr_accessor :raw