Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2952

SSE processing should trigger onUnrecoverableError when an incorrect RetryAfter value is used.

XMLWordPrintable

      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;
               }
       

              jperkins-rhn James Perkins
              jim_krueger Jim Krueger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: