vendor: update all dependencies to latest versions
This commit is contained in:
parent
8e83fb6fb9
commit
7d3a17725d
4878 changed files with 1974229 additions and 201215 deletions
20
vendor/github.com/pengsrc/go-shared/reopen/reopen.go
generated
vendored
20
vendor/github.com/pengsrc/go-shared/reopen/reopen.go
generated
vendored
|
@ -142,11 +142,17 @@ func (bw *BufferedFileWriter) Write(p []byte) (int, error) {
|
|||
}
|
||||
|
||||
// Flush flushes the buffer.
|
||||
func (bw *BufferedFileWriter) Flush() {
|
||||
func (bw *BufferedFileWriter) Flush() (err error) {
|
||||
bw.mu.Lock()
|
||||
bw.BufWriter.Flush()
|
||||
bw.OrigWriter.f.Sync()
|
||||
bw.mu.Unlock()
|
||||
defer bw.mu.Unlock()
|
||||
|
||||
if err = bw.BufWriter.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = bw.OrigWriter.f.Sync(); err != nil {
|
||||
return err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// flushDaemon periodically flushes the log file buffers.
|
||||
|
@ -156,9 +162,6 @@ func (bw *BufferedFileWriter) flushDaemon(interval time.Duration) {
|
|||
}
|
||||
}
|
||||
|
||||
const bufferSize = 256 * 1024
|
||||
const flushInterval = 30 * time.Second
|
||||
|
||||
// NewBufferedFileWriter opens a buffered file that is periodically flushed.
|
||||
func NewBufferedFileWriter(w *FileWriter) *BufferedFileWriter {
|
||||
return NewBufferedFileWriterSize(w, bufferSize, flushInterval)
|
||||
|
@ -174,3 +177,6 @@ func NewBufferedFileWriterSize(w *FileWriter, size int, flush time.Duration) *Bu
|
|||
go bw.flushDaemon(flush)
|
||||
return &bw
|
||||
}
|
||||
|
||||
const bufferSize = 256 * 1024
|
||||
const flushInterval = 30 * time.Second
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue