lib/embulk/input/jira_api/client.rb in embulk-input-jira-0.0.5 vs lib/embulk/input/jira_api/client.rb in embulk-input-jira-0.0.6

- old
+ new

@@ -1,13 +1,15 @@ require "jiralicious" +require "parallel" require "embulk/input/jira_api/issue" require "timeout" module Embulk module Input module JiraApi class Client + PARALLEL_THREAD_COUNT = 50 SEARCH_TIMEOUT_SECONDS = 5 SEARCH_ISSUES_TIMEOUT_SECONDS = 60 DEFAULT_SEARCH_RETRY_TIMES = 10 def self.setup(&block) @@ -15,10 +17,13 @@ new end def search_issues(jql, options={}) timeout_and_retry(SEARCH_ISSUES_TIMEOUT_SECONDS) do - search(jql, options).issues.map do |issue| + issues_raw = search(jql, options).issues_raw + Parallel.map(issues_raw, in_threads: PARALLEL_THREAD_COUNT) do |issue_raw| + # https://github.com/dorack/jiralicious/blob/v0.4.0/lib/jiralicious/search_result.rb#L32-34 + issue = Jiralicious::Issue.find(issue_raw["key"]) JiraApi::Issue.new(issue) end end end