Class: ProjectFeatureUsage
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ProjectFeatureUsage
- Defined in:
- app/models/project_feature_usage.rb
Constant Summary collapse
- JIRA_DVCS_CLOUD_FIELD =
'jira_dvcs_cloud_last_sync_at'
- JIRA_DVCS_SERVER_FIELD =
'jira_dvcs_server_last_sync_at'
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApplicationRecord
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
Methods included from SensitiveSerializableHash
Class Method Details
.jira_dvcs_integration_field(cloud: true) ⇒ Object
17 18 19 |
# File 'app/models/project_feature_usage.rb', line 17 def jira_dvcs_integration_field(cloud: true) cloud ? JIRA_DVCS_CLOUD_FIELD : JIRA_DVCS_SERVER_FIELD end |
Instance Method Details
#log_jira_dvcs_integration_usage(cloud: true) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/project_feature_usage.rb', line 22 def log_jira_dvcs_integration_usage(cloud: true) ::Gitlab::Database::LoadBalancing::Session.without_sticky_writes do integration_field = self.class.jira_dvcs_integration_field(cloud: cloud) # The feature usage is used only once later to query the feature usage in a # long date range. Therefore, we just need to update the timestamp once per # day break if persisted? && updated_today?(integration_field) persist_jira_dvcs_usage(integration_field) end end |