mirror of
1
Fork 0

Merge pull request '[v7.0/forgejo] Simplify delay writer Close' (#3005) from bp-v7.0/forgejo-6acedb9 into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3005
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-04-03 18:58:03 +00:00
commit 0a086dffc0
1 changed files with 3 additions and 4 deletions

View File

@ -139,11 +139,10 @@ func (d *delayWriter) WriteString(s string) (n int, err error) {
} }
func (d *delayWriter) Close() error { func (d *delayWriter) Close() error {
if d == nil { if d.timer.Stop() {
return nil d.buf = nil
} }
stopped := d.timer.Stop() if d.buf == nil {
if stopped || d.buf == nil {
return nil return nil
} }
_, err := d.internal.Write(d.buf.Bytes()) _, err := d.internal.Write(d.buf.Bytes())