diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 21:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 21:09:38 +0300 |
commit | 028bb5dda7abc9ec76f21ae8e691825b4673f733 (patch) | |
tree | a41741811452f928c6f650451c69fc18e46b62a4 /lib | |
parent | 7f305b576b51c3503970ef224cf4b31e247a322d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database/with_lock_retries.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/database/with_lock_retries.rb b/lib/gitlab/database/with_lock_retries.rb index 2f36bfa1480..bebcba6f42e 100644 --- a/lib/gitlab/database/with_lock_retries.rb +++ b/lib/gitlab/database/with_lock_retries.rb @@ -78,12 +78,18 @@ module Gitlab run_block_with_transaction rescue ActiveRecord::LockWaitTimeout if retry_with_lock_timeout? + disable_idle_in_transaction_timeout wait_until_next_retry + reset_db_settings retry else + reset_db_settings run_block_without_lock_timeout end + + ensure + reset_db_settings end end @@ -153,6 +159,14 @@ module Gitlab def current_sleep_time_in_seconds timing_configuration[current_iteration - 1][1].to_f end + + def disable_idle_in_transaction_timeout + execute("SET LOCAL idle_in_transaction_session_timeout TO '0'") + end + + def reset_db_settings + execute('RESET idle_in_transaction_session_timeout; RESET lock_timeout') + end end end end |