diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-10 21:11:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-10 21:11:08 +0300 |
commit | 4e50b9ed316f3c99693a41274babcd67c63ee640 (patch) | |
tree | 21f0f3a7f73a7dd51b06ba62ad9cfa3eaab85c9f /app/services/loose_foreign_keys | |
parent | 609943de5e2ee6c3bf0f09d3fb1d5fc38ed5a4ed (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/loose_foreign_keys')
-rw-r--r-- | app/services/loose_foreign_keys/process_deleted_records_service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/loose_foreign_keys/process_deleted_records_service.rb b/app/services/loose_foreign_keys/process_deleted_records_service.rb index 54f54d99afb..8700276c982 100644 --- a/app/services/loose_foreign_keys/process_deleted_records_service.rb +++ b/app/services/loose_foreign_keys/process_deleted_records_service.rb @@ -9,6 +9,7 @@ module LooseForeignKeys end def execute + raised_error = false modification_tracker = ModificationTracker.new tracked_tables.cycle do |table| records = load_batch_for_table(table) @@ -35,13 +36,30 @@ module LooseForeignKeys break if modification_tracker.over_limit? end + ::Gitlab::Metrics::LooseForeignKeysSlis.record_apdex( + success: !modification_tracker.over_limit?, + db_config_name: db_config_name + ) + modification_tracker.stats + rescue StandardError + raised_error = true + raise + ensure + ::Gitlab::Metrics::LooseForeignKeysSlis.record_error_rate( + error: raised_error, + db_config_name: db_config_name + ) end private attr_reader :connection + def db_config_name + ::Gitlab::Database.db_config_name(connection) + end + def load_batch_for_table(table) fully_qualified_table_name = "#{current_schema}.#{table}" LooseForeignKeys::DeletedRecord.load_batch_for_table(fully_qualified_table_name, BATCH_SIZE) |