defer closing tailable file via subcontext
+ update deps for defer f.Close()
This commit is contained in:
		| @@ -117,8 +117,10 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, deleteOk f | ||||
| 	} | ||||
| 	startSize := fi.Size() | ||||
|  | ||||
| 	// TODO: use inotify for file, and end with file deletion or replacement | ||||
| 	lineChan, errChan, err := util.TailFile(ctx, name, log.Offset, io.SeekStart) | ||||
| 	sctx, cancel := context.WithCancel(ctx) | ||||
| 	defer cancel() | ||||
|  | ||||
| 	lineChan, errChan, err := util.TailFile(sctx, name, log.Offset, io.SeekStart) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("tailing file: %w", err) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user