longPolling-demo icon indicating copy to clipboard operation
longPolling-demo copied to clipboard

the action of return response should be locked

Open wavesZh opened this issue 3 years ago • 0 comments

In ConfigServer

addListener method:

if (asyncTask.isTimeout()) {
      dataIdContext.remove(dataId, asyncTask);
      response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);  //  action1
      asyncContext.complete();
 }

publishConfig method:

response.setStatus(HttpServletResponse.SC_OK);  // action2
response.getWriter().println(configInfo);
asyncTask.getAsyncContext().complete();

if action1 and action2 happen at the same time, maybe return a response with 200 status code and blank configInfo.

wavesZh avatar Mar 07 '21 03:03 wavesZh