Skip to content

Commit e00d1e0

Browse files
committed
runner/v3: remove unused variable
1 parent f15d844 commit e00d1e0

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

internal/runner/runner.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (r *Runner) runBuilds(ctx context.Context, fn string) bool {
262262
}
263263
r.setServiceState(normalizeByEnvVarRules(sv.Name), status)
264264
}()
265-
if !r.startProcess(ctx, sv, -1, -1, fn, buf) {
265+
if !r.startProcess(ctx, sv, -1, fn, buf) {
266266
mu.Lock()
267267
ok = false
268268
localOk = false
@@ -279,29 +279,26 @@ func (r *Runner) runPermanent(changedFileName string) *oversight.Tree {
279279
tree := oversight.New(
280280
oversight.WithRestartStrategy(oversight.OneForAll()),
281281
oversight.NeverHalt())
282-
for j, sv := range r.Processes {
282+
for _, sv := range r.Processes {
283283
if strings.HasPrefix(sv.Name, "build") {
284284
continue
285285
}
286286
maxProc := r.Formation[sv.Name]
287-
portCount := j * 100
288287
for i := 0; i < maxProc; i++ {
289-
sv, i, pc := sv, i, portCount
290288
if sv.Restart == Loop || sv.Restart == Temporary || sv.Restart == OnFailure {
291289
continue
292290
}
293291
_ = tree.Add(oversight.ChildProcessSpecification{
294292
Name: sv.Name,
295293
Restart: oversight.Permanent(),
296294
Start: func(ctx context.Context) error {
297-
ok := r.startProcess(ctx, sv, i, pc, changedFileName, io.Discard)
295+
ok := r.startProcess(ctx, sv, i, changedFileName, io.Discard)
298296
if !ok && sv.Restart == OnFailure {
299297
return errors.New("restarting on failure")
300298
}
301299
return nil
302300
},
303301
})
304-
portCount++
305302
}
306303
}
307304
return tree
@@ -311,44 +308,39 @@ func (r *Runner) runEphemeral(ctx context.Context, changedFileName string) {
311308
tree := oversight.New(
312309
oversight.WithRestartStrategy(oversight.OneForAll()),
313310
oversight.NeverHalt())
314-
for j, sv := range r.Processes {
311+
for _, sv := range r.Processes {
315312
if strings.HasPrefix(sv.Name, "build") {
316313
continue
317314
}
318315
maxProc := r.Formation[sv.Name]
319-
portCount := j * 100
320316
for i := 0; i < maxProc; i++ {
321-
sv, i, pc := sv, i, portCount
322317
if sv.Restart == Loop {
323318
_ = tree.Add(oversight.ChildProcessSpecification{
324319
Name: sv.Name,
325320
Restart: oversight.Permanent(),
326321
Start: func(ctx context.Context) error {
327-
r.startProcess(ctx, sv, i, pc, changedFileName, io.Discard)
322+
r.startProcess(ctx, sv, i, changedFileName, io.Discard)
328323
return nil
329324
},
330325
})
331-
portCount++
332326
} else if sv.Restart == Temporary {
333327
_ = tree.Add(oversight.ChildProcessSpecification{
334328
Name: sv.Name,
335329
Restart: oversight.Temporary(),
336330
Start: func(ctx context.Context) error {
337-
r.startProcess(ctx, sv, i, pc, changedFileName, io.Discard)
331+
r.startProcess(ctx, sv, i, changedFileName, io.Discard)
338332
return nil
339333
},
340334
})
341-
portCount++
342335
} else if sv.Restart == OnFailure {
343336
_ = tree.Add(oversight.ChildProcessSpecification{
344337
Name: sv.Name,
345338
Restart: oversight.Transient(),
346339
Start: func(ctx context.Context) error {
347-
r.startProcess(ctx, sv, i, pc, changedFileName, io.Discard)
340+
r.startProcess(ctx, sv, i, changedFileName, io.Discard)
348341
return nil
349342
},
350343
})
351-
portCount++
352344
}
353345
}
354346
}
@@ -373,7 +365,7 @@ func normalizeByEnvVarRules(name string) string {
373365
return strings.ToUpper(buf.String())
374366
}
375367

376-
func (r *Runner) startProcess(ctx context.Context, sv *ProcessType, procCount, portCount int, changedFileName string, buf io.Writer) bool {
368+
func (r *Runner) startProcess(ctx context.Context, sv *ProcessType, procCount int, changedFileName string, buf io.Writer) bool {
377369
pr, pw := io.Pipe()
378370
procName := sv.Name
379371
if procCount > -1 {

0 commit comments

Comments
 (0)