mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 14:46:05 +10:00
While Octokit auto pagination set the page size to the maximum 100, and seek to not overstep the rate limit. When the rate limit is reached its raises an exception, and stop doing new requests. Here we use a custom pattern for traversing large lists, so we can check if we’ll reach the rate limit and wait the API to reset the rate limit before making new requests.
28 lines
409 B
Ruby
28 lines
409 B
Ruby
module Gitlab
|
|
module GithubImport
|
|
class LabelFormatter < BaseFormatter
|
|
def attributes
|
|
{
|
|
project: project,
|
|
title: title,
|
|
color: color
|
|
}
|
|
end
|
|
|
|
def create!
|
|
Label.create!(self.attributes)
|
|
end
|
|
|
|
private
|
|
|
|
def color
|
|
"##{raw_data.color}"
|
|
end
|
|
|
|
def title
|
|
raw_data.name
|
|
end
|
|
end
|
|
end
|
|
end
|