Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 12:07:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 12:07:45 +0300
commitb11f7057d067885619ee3e513751f180b2e8ad85 (patch)
treedfb3077ea8716ed217f5ce4324be4e25a450c599 /lib/gitlab/jira_import.rb
parente50050a8756a20b6aa118edbad3369674e4c63ba (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/jira_import.rb')
-rw-r--r--lib/gitlab/jira_import.rb35
1 files changed, 29 insertions, 6 deletions
diff --git a/lib/gitlab/jira_import.rb b/lib/gitlab/jira_import.rb
index 1486c754caf..fe4351d9029 100644
--- a/lib/gitlab/jira_import.rb
+++ b/lib/gitlab/jira_import.rb
@@ -6,6 +6,7 @@ module Gitlab
FAILED_ISSUES_COUNTER_KEY = 'jira-import/failed/%{project_id}/%{collection_type}'
NEXT_ITEMS_START_AT_KEY = 'jira-import/paginator/%{project_id}/%{collection_type}'
+ JIRA_IMPORT_LABEL = 'jira-import/import-label/%{project_id}'
ITEMS_MAPPER_CACHE_KEY = 'jira-import/items-mapper/%{project_id}/%{collection_type}/%{jira_isssue_id}'
ALREADY_IMPORTED_ITEMS_CACHE_KEY = 'jira-importer/already-imported/%{project}/%{collection_type}'
@@ -25,23 +26,45 @@ module Gitlab
FAILED_ISSUES_COUNTER_KEY % { project_id: project_id, collection_type: :issues }
end
+ def self.import_label_cache_key(project_id)
+ JIRA_IMPORT_LABEL % { project_id: project_id }
+ end
+
def self.increment_issue_failures(project_id)
- Gitlab::Cache::Import::Caching.increment(self.failed_issues_counter_cache_key(project_id))
+ cache_class.increment(self.failed_issues_counter_cache_key(project_id))
end
def self.get_issues_next_start_at(project_id)
- Gitlab::Cache::Import::Caching.read(self.jira_issues_next_page_cache_key(project_id)).to_i
+ cache_class.read(self.jira_issues_next_page_cache_key(project_id)).to_i
end
def self.store_issues_next_started_at(project_id, value)
cache_key = self.jira_issues_next_page_cache_key(project_id)
- Gitlab::Cache::Import::Caching.write(cache_key, value)
+ cache_class.write(cache_key, value)
+ end
+
+ def self.cache_issue_mapping(issue_id, jira_issue_id, project_id)
+ cache_key = JiraImport.jira_issue_cache_key(project_id, jira_issue_id)
+ cache_class.write(cache_key, issue_id)
+ end
+
+ def self.get_import_label_id(project_id)
+ cache_class.read(JiraImport.import_label_cache_key(project_id))
+ end
+
+ def self.cache_import_label_id(project_id, label_id)
+ cache_class.write(JiraImport.import_label_cache_key(project_id), label_id)
end
def self.cache_cleanup(project_id)
- Gitlab::Cache::Import::Caching.expire(self.failed_issues_counter_cache_key(project_id), JIRA_IMPORT_CACHE_TIMEOUT)
- Gitlab::Cache::Import::Caching.expire(self.jira_issues_next_page_cache_key(project_id), JIRA_IMPORT_CACHE_TIMEOUT)
- Gitlab::Cache::Import::Caching.expire(self.already_imported_cache_key(:issues, project_id), JIRA_IMPORT_CACHE_TIMEOUT)
+ cache_class.expire(self.import_label_cache_key(project_id), JIRA_IMPORT_CACHE_TIMEOUT)
+ cache_class.expire(self.failed_issues_counter_cache_key(project_id), JIRA_IMPORT_CACHE_TIMEOUT)
+ cache_class.expire(self.jira_issues_next_page_cache_key(project_id), JIRA_IMPORT_CACHE_TIMEOUT)
+ cache_class.expire(self.already_imported_cache_key(:issues, project_id), JIRA_IMPORT_CACHE_TIMEOUT)
+ end
+
+ def self.cache_class
+ Gitlab::Cache::Import::Caching
end
end
end