0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 23:33:15 -05:00

Merge pull request 'Simplify delay writer Close' (#2994) from gusted/forgejo-simplify into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2994
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
This commit is contained in:
oliverpool 2024-04-03 17:25:55 +00:00
commit 6f807c3519

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())