mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
fix(GODT-2800): Ensure 429 does not cause bad event
This commit is contained in:
@ -413,7 +413,7 @@ func (s *Service) handleEventError(ctx context.Context, lastEventID string, even
|
||||
}
|
||||
|
||||
// If the error is a server-side issue, return error to retry later.
|
||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) && apiErr.Status >= 500 {
|
||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) && (apiErr.Status == 429 || apiErr.Status >= 500) {
|
||||
return subscriberName, fmt.Errorf("failed to handle event due to server error: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@ -120,6 +120,7 @@ func TestServiceHandleEventError_NoBadEventCheck(t *testing.T) {
|
||||
_, _ = service.handleEventError(context.Background(), lastEventID, event, &net.OpError{})
|
||||
_, _ = service.handleEventError(context.Background(), lastEventID, event, io.ErrUnexpectedEOF)
|
||||
_, _ = service.handleEventError(context.Background(), lastEventID, event, &proton.APIError{Status: 500})
|
||||
_, _ = service.handleEventError(context.Background(), lastEventID, event, &proton.APIError{Status: 429})
|
||||
}
|
||||
|
||||
func TestServiceHandleEventError_JsonUnmarshalEventProducesUncategorizedErrorEvent(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user