Class: ProcessCommitWorker
- Inherits:
-
Object
- Object
- ProcessCommitWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/process_commit_worker.rb
Overview
Worker for processing individual commit messages pushed to a repository.
Jobs for this worker are scheduled for every commit that contains mentionable references in its message and does not exist in the upstream project. As a result of this the workload of this worker should be kept to a bare minimum. Consider using an extra worker if you need to add any extra (and potentially slow) processing of commits.
Constant Summary collapse
- MAX_TIME_TRACKING_REFERENCES =
5
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
-
#perform(project_id, user_id, commit_hash, default = false) ⇒ Object
project_id - The ID of the project this commit belongs to.
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(project_id, user_id, commit_hash, default = false) ⇒ Object
project_id - The ID of the project this commit belongs to. user_id - The ID of the user that pushed the commit. commit_hash - Hash containing commit details to use for constructing a
Commit object without having to use the Git repository.
default - The data was pushed to the default branch.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/workers/process_commit_worker.rb', line 33 def perform(project_id, user_id, commit_hash, default = false) project = Project.id_in(project_id).first return unless project user = User.id_in(user_id).first return unless user commit = Commit.build_from_sidekiq_hash(project, commit_hash) (project, commit, user, default) update_issue_metrics(commit, user) end |