mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
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:
@ -650,6 +650,8 @@ func (user *User) doEventPoll(ctx context.Context) error {
|
|||||||
UserID: user.ID(),
|
UserID: user.ID(),
|
||||||
Error: err,
|
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.
|
// 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(),
|
UserID: user.ID(),
|
||||||
Error: err,
|
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.
|
// If the error is a server-side issue, return error to retry later.
|
||||||
|
|||||||
Reference in New Issue
Block a user