Class: JiraImportState
Constant Summary
collapse
- ERROR_MESSAGE_SIZE =
1000
- STATUSES =
{ initial: 0, scheduled: 1, started: 2, failed: 3, finished: 4 }.freeze
ApplicationRecord::MAX_PLUCK
Instance Method Summary
collapse
#run_after_commit, #run_after_commit_or_now
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Instance Method Details
#in_progress? ⇒ Boolean
89
90
91
|
# File 'app/models/jira_import_state.rb', line 89
def in_progress?
scheduled? || started?
end
|
#mark_as_failed(error_message) ⇒ Object
113
114
115
116
117
118
119
|
# File 'app/models/jira_import_state.rb', line 113
def mark_as_failed(error_message)
sanitized_message = Gitlab::UrlSanitizer.sanitize(error_message)
do_fail(error_message: error_message)
rescue ActiveRecord::ActiveRecordError => e
Gitlab::AppLogger.error("Error setting import status to failed: #{e.message}. Original error: #{sanitized_message}")
end
|
#non_initial? ⇒ Boolean
93
94
95
|
# File 'app/models/jira_import_state.rb', line 93
def non_initial?
!initial?
end
|
#store_issue_counts ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'app/models/jira_import_state.rb', line 97
def store_issue_counts
import_label_id = Gitlab::JiraImport.get_import_label_id(project.id)
failed_to_import_count = Gitlab::JiraImport.issue_failures(project.id)
successfully_imported_count = project.issues.with_label_ids(import_label_id).count
total_issue_count = successfully_imported_count + failed_to_import_count
update(
{
failed_to_import_count: failed_to_import_count,
imported_issues_count: successfully_imported_count,
total_issue_count: total_issue_count
}
)
end
|