diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /qa/qa/support/retrier.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) | |
download | gitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'qa/qa/support/retrier.rb')
-rw-r--r-- | qa/qa/support/retrier.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qa/qa/support/retrier.rb b/qa/qa/support/retrier.rb index 25dbb42cf6f..fde8ac263ca 100644 --- a/qa/qa/support/retrier.rb +++ b/qa/qa/support/retrier.rb @@ -7,21 +7,21 @@ module QA module_function - def retry_on_exception(max_attempts: 3, reload_page: nil, sleep_interval: 0.5) - QA::Runtime::Logger.debug( - <<~MSG.tr("\n", ' ') - with retry_on_exception: max_attempts: #{max_attempts}; - reload_page: #{reload_page}; - sleep_interval: #{sleep_interval} - MSG - ) + def retry_on_exception(max_attempts: 3, reload_page: nil, sleep_interval: 0.5, log: true) + if log + msg = ["with retry_on_exception: max_attempts: #{max_attempts}"] + msg << "reload_page: #{reload_page}" if reload_page + msg << "sleep_interval: #{sleep_interval}" + QA::Runtime::Logger.debug(msg.join('; ')) + end result = nil repeat_until( max_attempts: max_attempts, reload_page: reload_page, sleep_interval: sleep_interval, - retry_on_exception: true + retry_on_exception: true, + log: log ) do result = yield @@ -29,7 +29,7 @@ module QA # We set it to `true` so that it doesn't repeat if there's no exception true end - QA::Runtime::Logger.debug("ended retry_on_exception") + QA::Runtime::Logger.debug("ended retry_on_exception") if log result end |