diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-10-30 14:57:09 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-10-30 15:15:52 +0300 |
commit | 1842b7f8707a1e2814fda3e1ebd3d5f94ade3294 (patch) | |
tree | d8410c7b46f524da2355606a98aad5b604bd9919 | |
parent | 83a324f4897bf080304c82cd3548225dbb854503 (diff) |
Merge branch '39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout' into 'master'
Resolve "ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR: canceling statement due to statement timeout"
Closes #39054
See merge request gitlab-org/gitlab-ce!15063
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b19f1a50506..e1780072f5f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -892,7 +892,7 @@ class MergeRequest < ActiveRecord::Base # def all_commit_shas if persisted? - column_shas = MergeRequestDiffCommit.where(merge_request_diff: merge_request_diffs).pluck('DISTINCT(sha)') + column_shas = MergeRequestDiffCommit.where(merge_request_diff: merge_request_diffs).limit(10_000).pluck('sha') serialised_shas = merge_request_diffs.where.not(st_commits: nil).flat_map(&:commit_shas) (column_shas + serialised_shas).uniq diff --git a/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml b/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml new file mode 100644 index 00000000000..47bf30ecb5a --- /dev/null +++ b/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml @@ -0,0 +1,5 @@ +--- +title: Stop merge requests with thousands of commits from timing out +merge_request: 15063 +author: +type: performance |