Class: ProjectImportState
Constant Summary
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
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
#completed? ⇒ Boolean
142
143
144
|
# File 'app/models/project_import_state.rb', line 142
def completed?
finished? || failed? || canceled?
end
|
#expire_etag_cache ⇒ Object
#in_progress? ⇒ Boolean
138
139
140
|
# File 'app/models/project_import_state.rb', line 138
def in_progress?
scheduled? || started?
end
|
#mark_as_failed(error_message) ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'app/models/project_import_state.rb', line 116
def mark_as_failed(error_message)
original_errors = errors.dup
sanitized_message = Gitlab::UrlSanitizer.sanitize(error_message)
fail_op
update_column(:last_error, sanitized_message)
rescue ActiveRecord::ActiveRecordError => e
Gitlab::Import::Logger.error(
message: 'Error setting import status to failed',
error: e.message,
original_error: sanitized_message
)
ensure
@errors = original_errors
end
|
#realtime_changes_path ⇒ Object
105
106
107
108
109
110
|
# File 'app/models/project_import_state.rb', line 105
def realtime_changes_path
Gitlab::Routing.url_helpers.polymorphic_path([:realtime_changes_import, project.import_type.to_sym], format: :json)
rescue NoMethodError
nil
end
|
#relation_hard_failures(limit:) ⇒ Object
112
113
114
|
# File 'app/models/project_import_state.rb', line 112
def relation_hard_failures(limit:)
project.import_failures.hard_failures_by_correlation_id(correlation_id).limit(limit)
end
|
#started? ⇒ Boolean
146
147
148
149
|
# File 'app/models/project_import_state.rb', line 146
def started?
status == 'started' && project.import?
end
|