Skip to content

Commit

Permalink
fix: Fixed the List method repeatedly placing objects into the channe…
Browse files Browse the repository at this point in the history
…l to be migrated (#336)
  • Loading branch information
abyss-w authored Aug 2, 2024
1 parent a32bdfc commit d753e36
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions migrate/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func copyTask(ctx context.Context) (err error) {
}

if !isFinished(ctx) {
//t.Status = constants.TaskStatusRerun
return constants.ErrTaskNotFinished
}

Expand Down
34 changes: 19 additions & 15 deletions migrate/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,14 @@ func List(ctx context.Context) (err error) {
if err != nil {
logrus.Panic(err)
}
}

// Traverse already running but not finished directory object.
p := ""
for {
do, err := model.NextDirectoryObject(ctx, p)
if err != nil {
logrus.Panic(err)
}
if do == nil {
break
}

jwg.Add(1)
jc <- do
p = do.Key
jc <- o
return nil
}

// Traverse already running but not finished single object.
p = ""
p := ""
for {
so, err := model.NextSingleObject(ctx, p)
if err != nil {
Expand Down Expand Up @@ -77,6 +65,22 @@ func List(ctx context.Context) (err error) {
pn = po.PartNumber
}

// Traverse already running but not finished directory object.
p = ""
for {
do, err := model.NextDirectoryObject(ctx, p)
if err != nil {
logrus.Panic(err)
}
if do == nil {
break
}

jwg.Add(1)
jc <- do
p = do.Key
}

return
}

Expand Down

0 comments on commit d753e36

Please sign in to comment.