Add retry logic for failures during import
As part of our short term effort to improve imports &1810 (closed) as explained in #39100 (closed)
We have some intermittent failures during import when accessing internal services, like Gitaly, DB.
This MR introduces retry mechanism for following exceptions:
-
ActiveRecord::StatementInvalid
: Superclass for all database execution errors. -
GRPC::DeadlineExceeded
: Gitaly timeout
It will retry only on relation.save!
, with intent of trying this at most 3 times.
Total number of retries, final retry status and exception details are stored in ImportFailure
.
If retry succeed, retried status is set to success
, otherwise we set status to failed
Conformity
-
Changelog entry -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides
Availability and Testing
This change should have very little impact on performance of the application, but it should make import more reliable.
Relates #39100 (closed)
Edited by 🤖 GitLab Bot 🤖