Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/src/campaigns_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func campaignsExecute(ctx context.Context, out *output.Output, svc *campaigns.Se
} else {
opts.Parallelism = flags.parallelism
}
executor := svc.NewExecutor(opts, nil)
executor := svc.NewExecutor(opts)

if errs != nil {
return "", "", errs
Expand Down
10 changes: 1 addition & 9 deletions internal/campaigns/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ type TaskStatus struct {
Err error
}

type ExecutorUpdateCallback func(*Task, TaskStatus)

type executor struct {
ExecutorOpts

Expand All @@ -81,13 +79,11 @@ type executor struct {
par *parallel.Run
doneEnqueuing chan struct{}

update ExecutorUpdateCallback

specs []*ChangesetSpec
specsMu sync.Mutex
}

func newExecutor(opts ExecutorOpts, client api.Client, update ExecutorUpdateCallback) *executor {
func newExecutor(opts ExecutorOpts, client api.Client) *executor {
return &executor{
ExecutorOpts: opts,
cache: opts.Cache,
Expand All @@ -97,7 +93,6 @@ func newExecutor(opts ExecutorOpts, client api.Client, update ExecutorUpdateCall
logger: NewLogManager(opts.TempDir, opts.KeepLogs),
tempDir: opts.TempDir,
par: parallel.NewRun(opts.Parallelism),
update: update,
}
}

Expand Down Expand Up @@ -272,9 +267,6 @@ func (x *executor) do(ctx context.Context, task *Task) (err error) {

func (x *executor) updateTaskStatus(task *Task, status *TaskStatus) {
x.tasks.Store(task, status)
if x.update != nil {
x.update(task, *status)
}
}

type errTimeoutReached struct{ timeout time.Duration }
Expand Down
2 changes: 1 addition & 1 deletion internal/campaigns/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestExecutor_Integration(t *testing.T) {
opts.Timeout = 5 * time.Second
}

executor := newExecutor(opts, client, nil)
executor := newExecutor(opts, client)

template := &ChangesetTemplate{}
for _, r := range tc.repos {
Expand Down
4 changes: 2 additions & 2 deletions internal/campaigns/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ type ExecutorOpts struct {
CacheDir string
}

func (svc *Service) NewExecutor(opts ExecutorOpts, update ExecutorUpdateCallback) Executor {
return newExecutor(opts, svc.client, update)
func (svc *Service) NewExecutor(opts ExecutorOpts) Executor {
return newExecutor(opts, svc.client)
}

func (svc *Service) NewWorkspaceCreator(dir string, cleanArchives bool) *WorkspaceCreator {
Expand Down