Merge pull request #5436 from ShuBo6/dev

fix: Missing close statements file.Close() & ticker.Stop()
This commit is contained in:
Tarun Koyalwar 2024-07-24 16:50:30 +05:30 committed by GitHub
commit cb2e6523f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -142,7 +142,7 @@ func (u *UploadWriter) autoCommit(ctx context.Context, r *io.PipeReader) {
// temporary buffer to store the results
buff := &bytes.Buffer{}
ticker := time.NewTicker(flushTimer)
defer ticker.Stop()
for {
select {
case <-ctx.Done():

View File

@ -30,6 +30,7 @@ func (s *ScanEventsCharts) GenerateHTML(filePath string) error {
if err != nil {
return err
}
defer output.Close()
return page.Render(output)
}

View File

@ -56,6 +56,7 @@ func (s *ScanStatsWorker) initEventsFile() error {
if err != nil {
return err
}
defer f.Close()
s.enc = json.NewEncoder(f)
return nil
}