perf: cache catchupped status
This commit is contained in:
		| @@ -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,12 +129,16 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue | |||||||
| 				return nil | 				return nil | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if line.EndOffset > startSize { | 			if !catchUpped { | ||||||
|  | 				catchUpped = line.EndOffset > startSize | ||||||
|  |  | ||||||
|  | 				if catchUpped { | ||||||
| 					select { | 					select { | ||||||
| 					case sigCatchupped <- struct{}{}: | 					case sigCatchupped <- struct{}{}: | ||||||
| 					default: | 					default: | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			if line.String == "" { | 			if line.String == "" { | ||||||
| 				continue | 				continue | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user