Skip to content

Commit 8c81256

Browse files
committed
OneDev migration: moved memory allocation for milestone JSON decoding into for loop (which gets 100 milestones per iteration) to fix wrong due dates when having more than 100 milestones
1 parent 0ce5880 commit 8c81256

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

services/migrations/onedev.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,19 @@ func (d *OneDevDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, e
212212

213213
// GetMilestones returns milestones
214214
func (d *OneDevDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error) {
215-
rawMilestones := make([]struct {
216-
ID int64 `json:"id"`
217-
Name string `json:"name"`
218-
Description string `json:"description"`
219-
DueDay int64 `json:"dueDay"`
220-
Closed bool `json:"closed"`
221-
}, 0, 100)
222-
223215
endpoint := fmt.Sprintf("/~api/projects/%d/iterations", d.repoID)
224216

225217
milestones := make([]*base.Milestone, 0, 100)
226218
offset := 0
227219
for {
220+
rawMilestones := make([]struct {
221+
ID int64 `json:"id"`
222+
Name string `json:"name"`
223+
Description string `json:"description"`
224+
DueDay int64 `json:"dueDay"`
225+
Closed bool `json:"closed"`
226+
}, 0, 100)
227+
228228
err := d.callAPI(
229229
ctx,
230230
endpoint,

0 commit comments

Comments
 (0)