Skip to content

Commit

Permalink
DEVPROD-14995: remove check for number of task directories that fail …
Browse files Browse the repository at this point in the history
…to clean up (#8810)
  • Loading branch information
Kimchelly authored Mar 10, 2025
1 parent 48bd8ed commit f224527
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
9 changes: 3 additions & 6 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ type Agent struct {
// completion.
addMetadataTagResp func(*triggerAddMetadataTagResp)
addMetadataTagMutex sync.RWMutex
// numTaskDirCleanupFailures is the number of times the agent has tried and
// failed to clean up the task directory.
numTaskDirCleanupFailures int
tracer trace.Tracer
otelGrpcConn *grpc.ClientConn
closers []closerOp
tracer trace.Tracer
otelGrpcConn *grpc.ClientConn
closers []closerOp
}

// Options contains startup options for an Agent.
Expand Down
11 changes: 0 additions & 11 deletions agent/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ func (a *Agent) removeAllAndCheck(ctx context.Context, dir string) error {
return nil
}

a.numTaskDirCleanupFailures++

checkCtx, checkCancel := context.WithTimeout(ctx, time.Minute)
defer checkCancel()
if err := a.checkDataDirectoryHealth(checkCtx); err != nil {
Expand Down Expand Up @@ -211,15 +209,6 @@ func (a *Agent) tryCleanupDirectory(ctx context.Context, dir string) {
}

func (a *Agent) checkDataDirectoryHealth(ctx context.Context) error {
if a.numTaskDirCleanupFailures >= globals.MaxTaskDirCleanupFailures {
err := a.comm.DisableHost(ctx, a.opts.HostID, apimodels.DisableInfo{
Reason: fmt.Sprintf("agent has tried and failed to clean up task directories %d times", a.numTaskDirCleanupFailures),
})
if err != nil {
return err
}
}

usage, err := disk.UsageWithContext(ctx, a.opts.WorkingDirectory)
if err != nil {
return errors.Wrap(err, "getting disk usage")
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (

// Agent version to control agent rollover. The format is the calendar date
// (YYYY-MM-DD).
AgentVersion = "2025-03-08"
AgentVersion = "2025-03-10"
)

const (
Expand Down

0 comments on commit f224527

Please sign in to comment.