mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 20:07:03 +01:00
Simplify delay writer Close
Per https://codeberg.org/forgejo/forgejo/pulls/2983#issuecomment-1730756
This commit is contained in:
parent
7d35a76ebf
commit
6acedb973a
1 changed files with 3 additions and 4 deletions
|
@ -139,11 +139,10 @@ func (d *delayWriter) WriteString(s string) (n int, err error) {
|
|||
}
|
||||
|
||||
func (d *delayWriter) Close() error {
|
||||
if d == nil {
|
||||
return nil
|
||||
if d.timer.Stop() {
|
||||
d.buf = nil
|
||||
}
|
||||
stopped := d.timer.Stop()
|
||||
if stopped || d.buf == nil {
|
||||
if d.buf == nil {
|
||||
return nil
|
||||
}
|
||||
_, err := d.internal.Write(d.buf.Bytes())
|
||||
|
|
Loading…
Reference in a new issue