diff options
author | mhasbini <mohammad.hasbini@gmail.com> | 2017-04-04 13:54:58 +0300 |
---|---|---|
committer | mhasbini <mohammad.hasbini@gmail.com> | 2017-04-04 13:54:58 +0300 |
commit | e52b1df1d5391f0fa0b9ec7eb2d3492b05f64ba4 (patch) | |
tree | c9fbd2c57dae0a5872653d3df0b9a681a5441404 /app | |
parent | 9fc17f6f4abdb04f3cf1b60b87bd67b894a19c39 (diff) | |
download | gitlab-ce-e52b1df1d5391f0fa0b9ec7eb2d3492b05f64ba4.tar.gz |
Remove useless queries with false conditions (e.g 1=0)
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/concerns/issuable_collections.rb | 3 | ||||
-rw-r--r-- | app/workers/process_commit_worker.rb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index 85ae4985e58..c8a501d7319 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -15,6 +15,9 @@ module IssuableCollections # a new order into the collection. # We cannot use reorder to not mess up the paginated collection. issuable_ids = issuable_collection.map(&:id) + + return {} if issuable_ids.empty? + issuable_note_count = Note.count_for_collection(issuable_ids, @collection_type) issuable_votes_count = AwardEmoji.votes_for_collection(issuable_ids, @collection_type) issuable_merge_requests_count = diff --git a/app/workers/process_commit_worker.rb b/app/workers/process_commit_worker.rb index e9a5bd7f24e..2f7967cf531 100644 --- a/app/workers/process_commit_worker.rb +++ b/app/workers/process_commit_worker.rb @@ -53,6 +53,8 @@ class ProcessCommitWorker def update_issue_metrics(commit, author) mentioned_issues = commit.all_references(author).issues + return if mentioned_issues.empty? + Issue::Metrics.where(issue_id: mentioned_issues.map(&:id), first_mentioned_in_commit_at: nil). update_all(first_mentioned_in_commit_at: commit.committed_date) end |