Skip to content

Commit

Permalink
runner/v3: remove debounce logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ucirello committed Oct 17, 2024
1 parent 21185d5 commit a74038c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.23

require (
cirello.io/oversight v1.4.0
cirello.io/takelatest v1.1.1
github.com/buildkite/terminal-to-html/v3 v3.16.3
github.com/google/go-cmp v0.6.0
golang.org/x/tools v0.26.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cirello.io/oversight v1.4.0 h1:wYxebS4OGYQz/c/kcGcqxINPuJDbLNnVloQIsdSWua0=
cirello.io/oversight v1.4.0/go.mod h1:gDVpsAKKoNtDhEWd1PjD4yBE6r6y5bXSHpOQ2joJF6E=
cirello.io/takelatest v1.1.1 h1:x+M5YTPWy+7+4xKH01boh55Ljhwd94ZZl6J6hNi/2EA=
cirello.io/takelatest v1.1.1/go.mod h1:gIkdUHPkmHbvJlx1epb6zXvarThOQgTtY3orE/CgImw=
github.com/buildkite/terminal-to-html/v3 v3.16.3 h1:IGuJjboHjuMLWOGsKZKNxbbn41emOLiHzXPmQZk31fk=
github.com/buildkite/terminal-to-html/v3 v3.16.3/go.mod h1:r/J7cC9c3EzBzP3/wDz0RJLPwv5PUAMp+KF2w+ntMc0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down
34 changes: 11 additions & 23 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"time"

"cirello.io/oversight"
"cirello.io/takelatest"
)

// ErrNonUniqueProcessTypeName is returned when starting the runner, it detects
Expand Down Expand Up @@ -209,27 +208,6 @@ func (r *Runner) Start(rootCtx context.Context) error {
r.runEphemeral(rootCtx, "")
}()
})
type update struct {
ctx context.Context
fn string
}
lastflightRun := &takelatest.Runner[update]{
Func: func(ctx context.Context, update update) {
if ctx.Err() != nil {
return
}
wg.Add(1)
defer wg.Done()
if ok := r.runBuilds(update.ctx, update.fn); !ok {
log.Println("error during build, halted")
return
}
ephemeralOnce()
tree := r.runPermanent(update.fn)
_ = tree.Start(update.ctx)
},
}
defer lastflightRun.Close()
updates := r.monitorWorkDir(rootCtx)
for {
select {
Expand All @@ -241,7 +219,17 @@ func (r *Runner) Start(rootCtx context.Context) error {
runCancel()
ctx, cancel := context.WithCancel(rootCtx)
runCancel = cancel
lastflightRun.Take(update{ctx, fn})
if ok := r.runBuilds(ctx, fn); !ok {
log.Println("error during build, halted")
continue
}
ephemeralOnce()
tree := r.runPermanent(fn)
wg.Add(1)
go func() {
defer wg.Done()
_ = tree.Start(ctx)
}()
}
}
}
Expand Down

0 comments on commit a74038c

Please sign in to comment.