Skip to content

Commit 2fdf37c

Browse files
authored
Remove unused callback from Executor (#337)
This was used in the old architecture but has been replaced by the TaskStatus callbacks.
1 parent 44a4d13 commit 2fdf37c

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

cmd/src/campaigns_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func campaignsExecute(ctx context.Context, out *output.Output, svc *campaigns.Se
186186
} else {
187187
opts.Parallelism = flags.parallelism
188188
}
189-
executor := svc.NewExecutor(opts, nil)
189+
executor := svc.NewExecutor(opts)
190190

191191
if errs != nil {
192192
return "", "", errs

internal/campaigns/executor.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ type TaskStatus struct {
6666
Err error
6767
}
6868

69-
type ExecutorUpdateCallback func(*Task, TaskStatus)
70-
7169
type executor struct {
7270
ExecutorOpts
7371

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

84-
update ExecutorUpdateCallback
85-
8682
specs []*ChangesetSpec
8783
specsMu sync.Mutex
8884
}
8985

90-
func newExecutor(opts ExecutorOpts, client api.Client, update ExecutorUpdateCallback) *executor {
86+
func newExecutor(opts ExecutorOpts, client api.Client) *executor {
9187
return &executor{
9288
ExecutorOpts: opts,
9389
cache: opts.Cache,
@@ -97,7 +93,6 @@ func newExecutor(opts ExecutorOpts, client api.Client, update ExecutorUpdateCall
9793
logger: NewLogManager(opts.TempDir, opts.KeepLogs),
9894
tempDir: opts.TempDir,
9995
par: parallel.NewRun(opts.Parallelism),
100-
update: update,
10196
}
10297
}
10398

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

273268
func (x *executor) updateTaskStatus(task *Task, status *TaskStatus) {
274269
x.tasks.Store(task, status)
275-
if x.update != nil {
276-
x.update(task, *status)
277-
}
278270
}
279271

280272
type errTimeoutReached struct{ timeout time.Duration }

internal/campaigns/executor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func TestExecutor_Integration(t *testing.T) {
121121
opts.Timeout = 5 * time.Second
122122
}
123123

124-
executor := newExecutor(opts, client, nil)
124+
executor := newExecutor(opts, client)
125125

126126
template := &ChangesetTemplate{}
127127
for _, r := range tc.repos {

internal/campaigns/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ type ExecutorOpts struct {
150150
CacheDir string
151151
}
152152

153-
func (svc *Service) NewExecutor(opts ExecutorOpts, update ExecutorUpdateCallback) Executor {
154-
return newExecutor(opts, svc.client, update)
153+
func (svc *Service) NewExecutor(opts ExecutorOpts) Executor {
154+
return newExecutor(opts, svc.client)
155155
}
156156

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

0 commit comments

Comments
 (0)