fix(GODT-2404): Handle unexpected EOF

When fetching too many attachment bodies at once, the read can fail with
io.ErrUnexpectedEOF. In that case, we returun an error so the fetch is retried.
This commit is contained in:
James Houlahan
2023-02-24 16:02:15 +01:00
parent 51cbb91513
commit c15917aba4

View File

@ -650,6 +650,8 @@ func (user *User) doEventPoll(ctx context.Context) error {
UserID: user.ID(),
Error: err,
})
return fmt.Errorf("failed to get event due to JSON issue: %w", err)
}
// If the error is a server-side issue, return error to retry later.
@ -694,6 +696,18 @@ func (user *User) doEventPoll(ctx context.Context) error {
UserID: user.ID(),
Error: err,
})
return fmt.Errorf("failed to handle event due to JSON issue: %w", err)
}
// If the error is an unexpected EOF, return error to retry later.
if errors.Is(err, io.ErrUnexpectedEOF) {
user.eventCh.Enqueue(events.UncategorizedEventError{
UserID: user.ID(),
Error: err,
})
return fmt.Errorf("failed to handle event due to EOF: %w", err)
}
// If the error is a server-side issue, return error to retry later.