mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 10:40:26 +08:00
对缓存文件关闭事件也增加写入统计
This commit is contained in:
@@ -138,18 +138,24 @@ func (this *FileWriter) Close() error {
|
|||||||
|
|
||||||
err := this.WriteHeaderLength(types.Int(this.headerSize))
|
err := this.WriteHeaderLength(types.Int(this.headerSize))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
_ = os.Remove(path)
|
_ = os.Remove(path)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = this.WriteBodyLength(this.bodySize)
|
err = this.WriteBodyLength(this.bodySize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
_ = os.Remove(path)
|
_ = os.Remove(path)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fsutils.WriteBegin()
|
||||||
err = this.rawWriter.Close()
|
err = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = os.Remove(path)
|
_ = os.Remove(path)
|
||||||
} else if strings.HasSuffix(path, FileTmpSuffix) {
|
} else if strings.HasSuffix(path, FileTmpSuffix) {
|
||||||
@@ -168,7 +174,9 @@ func (this *FileWriter) Discard() error {
|
|||||||
this.endFunc()
|
this.endFunc()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
|
|
||||||
err := os.Remove(this.rawWriter.Name())
|
err := os.Remove(this.rawWriter.Name())
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -181,7 +181,9 @@ func (this *PartialFileWriter) Close() error {
|
|||||||
this.ranges.BodySize = this.bodySize
|
this.ranges.BodySize = this.bodySize
|
||||||
err := this.ranges.WriteToFile(this.rangePath)
|
err := this.ranges.WriteToFile(this.rangePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
this.remove()
|
this.remove()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -190,19 +192,25 @@ func (this *PartialFileWriter) Close() error {
|
|||||||
if this.isNew {
|
if this.isNew {
|
||||||
err = this.WriteHeaderLength(types.Int(this.headerSize))
|
err = this.WriteHeaderLength(types.Int(this.headerSize))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
this.remove()
|
this.remove()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = this.WriteBodyLength(this.bodySize)
|
err = this.WriteBodyLength(this.bodySize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
this.remove()
|
this.remove()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fsutils.WriteBegin()
|
||||||
err = this.rawWriter.Close()
|
err = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.remove()
|
this.remove()
|
||||||
}
|
}
|
||||||
@@ -216,7 +224,9 @@ func (this *PartialFileWriter) Discard() error {
|
|||||||
this.endFunc()
|
this.endFunc()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fsutils.WriteBegin()
|
||||||
_ = this.rawWriter.Close()
|
_ = this.rawWriter.Close()
|
||||||
|
fsutils.WriteEnd()
|
||||||
|
|
||||||
_ = os.Remove(this.rangePath)
|
_ = os.Remove(this.rangePath)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user