perf: cache catchupped status
This commit is contained in:
parent
77cf4b9dd8
commit
d142fa9295
@ -118,6 +118,7 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue
|
|||||||
return fmt.Errorf("tailing file: %w", err)
|
return fmt.Errorf("tailing file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var catchUpped bool // cache
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
@ -128,10 +129,14 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if line.EndOffset > startSize {
|
if !catchUpped {
|
||||||
select {
|
catchUpped = line.EndOffset > startSize
|
||||||
case sigCatchupped <- struct{}{}:
|
|
||||||
default:
|
if catchUpped {
|
||||||
|
select {
|
||||||
|
case sigCatchupped <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user