Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
Undefined
Description
The code in EventHandler.run() in SseEventSourceImpl correctly catches a ServiceUnavailableException and looks to reconnect if the exception contains a RetryAfter value. However, there currently is no checking to ensure that the RetryAfter value is valid (For example passing a string like "Never!").
To resolve this issue I propose the following change
-
catch (ServiceUnavailableException ex) { if (ex.hasRetryAfter()) { try { onConnection(); Date requestTime = new Date(); long localReconnectDelay = ex.getRetryTime(requestTime).getTime() - requestTime.getTime(); reconnect(localReconnectDelay); } catch (Throwable t) { onUnrecoverableError(t); } } else { onUnrecoverableError(ex); } return; }