Skip to content

Commit

Permalink
Additional file creation loop logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mcphailtom committed Oct 9, 2023
1 parent 056de6f commit d385cd1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions logfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,18 @@ func (lf *logFile) dataProcessor(ctx context.Context, ewCancelChan <-chan error,
case <-ctx.Done():
return
case so := <-lf.stateEvents:
if so == stateEventCreated {
switch so {
case stateEventCreated:
lf.created = true
break
case stateEventRemoved:
lf.created = false
continue creationLoop
default:
stopChan <- lf.filePath
lf.errorChan <- NewLogWhaleError(ErrorStateInternal, fmt.Sprintf("unexpected state event while waiting for file creation: %s", so), nil)
return
}
stopChan <- lf.filePath
lf.errorChan <- NewLogWhaleError(ErrorStateInternal, fmt.Sprintf("unexpected state event while waiting for file creation: %s", so), nil)
return
}
}

Expand Down

0 comments on commit d385cd1

Please sign in to comment.