@@ -49,144 +49,137 @@ func (d *RetryDownloader) retry(work func() error) error {
49
49
return err
50
50
}
51
51
52
- // SetContext set context
53
- func (d * RetryDownloader ) SetContext (ctx context.Context ) {
54
- d .ctx = ctx
55
- d .Downloader .SetContext (ctx )
56
- }
57
-
58
52
// GetRepoInfo returns a repository information with retry
59
- func (d * RetryDownloader ) GetRepoInfo () (* Repository , error ) {
53
+ func (d * RetryDownloader ) GetRepoInfo (ctx context. Context ) (* Repository , error ) {
60
54
var (
61
55
repo * Repository
62
56
err error
63
57
)
64
58
65
59
err = d .retry (func () error {
66
- repo , err = d .Downloader .GetRepoInfo ()
60
+ repo , err = d .Downloader .GetRepoInfo (ctx )
67
61
return err
68
62
})
69
63
70
64
return repo , err
71
65
}
72
66
73
67
// GetTopics returns a repository's topics with retry
74
- func (d * RetryDownloader ) GetTopics () ([]string , error ) {
68
+ func (d * RetryDownloader ) GetTopics (ctx context. Context ) ([]string , error ) {
75
69
var (
76
70
topics []string
77
71
err error
78
72
)
79
73
80
74
err = d .retry (func () error {
81
- topics , err = d .Downloader .GetTopics ()
75
+ topics , err = d .Downloader .GetTopics (ctx )
82
76
return err
83
77
})
84
78
85
79
return topics , err
86
80
}
87
81
88
82
// GetMilestones returns a repository's milestones with retry
89
- func (d * RetryDownloader ) GetMilestones () ([]* Milestone , error ) {
83
+ func (d * RetryDownloader ) GetMilestones (ctx context. Context ) ([]* Milestone , error ) {
90
84
var (
91
85
milestones []* Milestone
92
86
err error
93
87
)
94
88
95
89
err = d .retry (func () error {
96
- milestones , err = d .Downloader .GetMilestones ()
90
+ milestones , err = d .Downloader .GetMilestones (ctx )
97
91
return err
98
92
})
99
93
100
94
return milestones , err
101
95
}
102
96
103
97
// GetReleases returns a repository's releases with retry
104
- func (d * RetryDownloader ) GetReleases () ([]* Release , error ) {
98
+ func (d * RetryDownloader ) GetReleases (ctx context. Context ) ([]* Release , error ) {
105
99
var (
106
100
releases []* Release
107
101
err error
108
102
)
109
103
110
104
err = d .retry (func () error {
111
- releases , err = d .Downloader .GetReleases ()
105
+ releases , err = d .Downloader .GetReleases (ctx )
112
106
return err
113
107
})
114
108
115
109
return releases , err
116
110
}
117
111
118
112
// GetLabels returns a repository's labels with retry
119
- func (d * RetryDownloader ) GetLabels () ([]* Label , error ) {
113
+ func (d * RetryDownloader ) GetLabels (ctx context. Context ) ([]* Label , error ) {
120
114
var (
121
115
labels []* Label
122
116
err error
123
117
)
124
118
125
119
err = d .retry (func () error {
126
- labels , err = d .Downloader .GetLabels ()
120
+ labels , err = d .Downloader .GetLabels (ctx )
127
121
return err
128
122
})
129
123
130
124
return labels , err
131
125
}
132
126
133
127
// GetIssues returns a repository's issues with retry
134
- func (d * RetryDownloader ) GetIssues (page , perPage int ) ([]* Issue , bool , error ) {
128
+ func (d * RetryDownloader ) GetIssues (ctx context. Context , page , perPage int ) ([]* Issue , bool , error ) {
135
129
var (
136
130
issues []* Issue
137
131
isEnd bool
138
132
err error
139
133
)
140
134
141
135
err = d .retry (func () error {
142
- issues , isEnd , err = d .Downloader .GetIssues (page , perPage )
136
+ issues , isEnd , err = d .Downloader .GetIssues (ctx , page , perPage )
143
137
return err
144
138
})
145
139
146
140
return issues , isEnd , err
147
141
}
148
142
149
143
// GetComments returns a repository's comments with retry
150
- func (d * RetryDownloader ) GetComments (commentable Commentable ) ([]* Comment , bool , error ) {
144
+ func (d * RetryDownloader ) GetComments (ctx context. Context , commentable Commentable ) ([]* Comment , bool , error ) {
151
145
var (
152
146
comments []* Comment
153
147
isEnd bool
154
148
err error
155
149
)
156
150
157
151
err = d .retry (func () error {
158
- comments , isEnd , err = d .Downloader .GetComments (commentable )
152
+ comments , isEnd , err = d .Downloader .GetComments (ctx , commentable )
159
153
return err
160
154
})
161
155
162
156
return comments , isEnd , err
163
157
}
164
158
165
159
// GetPullRequests returns a repository's pull requests with retry
166
- func (d * RetryDownloader ) GetPullRequests (page , perPage int ) ([]* PullRequest , bool , error ) {
160
+ func (d * RetryDownloader ) GetPullRequests (ctx context. Context , page , perPage int ) ([]* PullRequest , bool , error ) {
167
161
var (
168
162
prs []* PullRequest
169
163
err error
170
164
isEnd bool
171
165
)
172
166
173
167
err = d .retry (func () error {
174
- prs , isEnd , err = d .Downloader .GetPullRequests (page , perPage )
168
+ prs , isEnd , err = d .Downloader .GetPullRequests (ctx , page , perPage )
175
169
return err
176
170
})
177
171
178
172
return prs , isEnd , err
179
173
}
180
174
181
175
// GetReviews returns pull requests reviews
182
- func (d * RetryDownloader ) GetReviews (reviewable Reviewable ) ([]* Review , error ) {
176
+ func (d * RetryDownloader ) GetReviews (ctx context. Context , reviewable Reviewable ) ([]* Review , error ) {
183
177
var (
184
178
reviews []* Review
185
179
err error
186
180
)
187
-
188
181
err = d .retry (func () error {
189
- reviews , err = d .Downloader .GetReviews (reviewable )
182
+ reviews , err = d .Downloader .GetReviews (ctx , reviewable )
190
183
return err
191
184
})
192
185
0 commit comments