mirror of
https://github.com/teacat/chaturbate-dvr.git
synced 2025-10-29 16:59:59 +00:00
Reverted ch.File = nil in Cleanup, to keep filename displayed
This commit is contained in:
parent
b8205a1b56
commit
8502d4429f
@ -2,6 +2,7 @@ package channel
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
@ -49,14 +50,13 @@ func (ch *Channel) Cleanup() error {
|
|||||||
defer func() {
|
defer func() {
|
||||||
ch.Filesize = 0
|
ch.Filesize = 0
|
||||||
ch.Duration = 0
|
ch.Duration = 0
|
||||||
ch.File = nil
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Sync the file to ensure data is written to disk
|
// Sync the file to ensure data is written to disk
|
||||||
if err := ch.File.Sync(); err != nil {
|
if err := ch.File.Sync(); err != nil && !errors.Is(err, os.ErrClosed) {
|
||||||
return fmt.Errorf("sync file: %w", err)
|
return fmt.Errorf("sync file: %w", err)
|
||||||
}
|
}
|
||||||
if err := ch.File.Close(); err != nil {
|
if err := ch.File.Close(); err != nil && !errors.Is(err, os.ErrClosed) {
|
||||||
return fmt.Errorf("close file: %w", err)
|
return fmt.Errorf("close file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user