Skip to content

Commit

Permalink
cleanup unneeded changes
Browse files Browse the repository at this point in the history
* remove changes that makes no effect/purpose.

Signed-off-by: bupd <[email protected]>
  • Loading branch information
bupd committed Feb 5, 2025
1 parent e9d7032 commit cafec6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions src/controller/jobmonitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ import (
"strings"
"time"

"github.com/gocraft/work"

"github.com/goharbor/harbor/src/common/job"
libRedis "github.com/goharbor/harbor/src/lib/redis"

jobSvc "github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/queuestatus"

"github.com/goharbor/harbor/src/lib/log"

"github.com/gocraft/work"

"github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/lib/q"
libRedis "github.com/goharbor/harbor/src/lib/redis"
jm "github.com/goharbor/harbor/src/pkg/jobmonitor"
"github.com/goharbor/harbor/src/pkg/task"
taskDao "github.com/goharbor/harbor/src/pkg/task/dao"
Expand Down
13 changes: 6 additions & 7 deletions src/controller/replication/flow/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *copyFlow) Run(ctx context.Context) error {
return err
}

return c.createTasks(ctx, srcResources, dstResources)
return c.createTasks(ctx, srcResources, dstResources, c.policy.Speed, c.policy.CopyByChunk)
}

func (c *copyFlow) isExecutionStopped(ctx context.Context) (bool, error) {
Expand All @@ -103,7 +103,7 @@ func (c *copyFlow) isExecutionStopped(ctx context.Context) (bool, error) {
return execution.Status == job.StoppedStatus.String(), nil
}

func (c *copyFlow) createTasks(ctx context.Context, srcResources, dstResources []*model.Resource) error {
func (c *copyFlow) createTasks(ctx context.Context, srcResources, dstResources []*model.Resource, speed int32, copyByChunk bool) error {
var taskCnt int
defer func() {
// if no task be created, mark execution done.
Expand Down Expand Up @@ -139,18 +139,17 @@ func (c *copyFlow) createTasks(ctx context.Context, srcResources, dstResources [
Parameters: map[string]interface{}{
"src_resource": string(src),
"dst_resource": string(dest),
"speed": c.policy.Speed,
"copy_by_chunk": c.policy.CopyByChunk,
"speed": speed,
"copy_by_chunk": copyByChunk,
},
}

if _, err = c.taskMgr.Create(ctx, c.executionID, job, map[string]interface{}{
"operation": "copy",
"resource_type": srcResource.Type,
"resource_type": string(srcResource.Type),
"source_resource": getResourceName(srcResource),
"destination_resource": getResourceName(dstResource),
"references": getResourceReferences(dstResource),
}); err != nil {
"references": getResourceReferences(dstResource)}); err != nil {
return err
}

Expand Down

0 comments on commit cafec6f

Please sign in to comment.