diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-11-24 17:07:44 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-12-01 15:36:06 +0300 |
commit | 6b4d33566f5f434cc86381a4a1347e42bbe348ee (patch) | |
tree | 441ea1ec210bbef063ec82d470b8e86d38ffec8c /app/models/commit.rb | |
parent | e91afc0dc071f2cb2dde54b12c04bb90d2c65f7b (diff) |
Pass commit data to ProcessCommitWorker
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.rb | 4 |
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 |