@@ -209,6 +209,7 @@ protected void doPipe(final HttpServletResponse resp, String key, String type, S
209209
210210 long lastPipeDataWritten = -1 ;
211211 long beforeLoop = System .currentTimeMillis ();
212+ int items = 0 ;
212213 if (SimplePipeHelper .notifyPipeStatus (key , true )) { // update it!
213214 List <SimpleSerializable > list = null ;
214215 int priority = 0 ;
@@ -218,7 +219,6 @@ protected void doPipe(final HttpServletResponse resp, String key, String type, S
218219 if (pipe != null ) {
219220 waitClosingInterval = pipe .pipeWaitClosingInterval ();
220221 }
221- int items = 0 ;
222222 while ((list = SimplePipeHelper .getPipeDataList (key )) != null
223223 /* && SimplePipeHelper.isPipeLive(key) */ // check it!
224224 && !writer .checkError ()) {
@@ -279,7 +279,8 @@ protected void doPipe(final HttpServletResponse resp, String key, String type, S
279279 if ((lastPipeDataWritten == -1 && now - beforeLoop >= pipeQueryTimeout )
280280 || (lastPipeDataWritten > 0
281281 && now - lastPipeDataWritten >= pipeQueryTimeout
282- && SimplePipeRequest .PIPE_TYPE_CONTINUUM .equals (type ))) {
282+ && (SimplePipeRequest .PIPE_TYPE_CONTINUUM .equals (type )
283+ || SimplePipeRequest .PIPE_TYPE_SCRIPT .equals (type )))) {
283284 output (writer , type , key , SimplePipeRequest .PIPE_STATUS_OK );
284285 lastPipeDataWritten = System .currentTimeMillis ();
285286 }
@@ -316,7 +317,8 @@ protected void doPipe(final HttpServletResponse resp, String key, String type, S
316317 // HTTP connection may be closed already!
317318 }
318319 } else if (SimplePipeRequest .PIPE_TYPE_SCRIPT .equals (type )
319- && System .currentTimeMillis () - beforeLoop >= pipeScriptBreakout ) {
320+ && (System .currentTimeMillis () - beforeLoop >= pipeScriptBreakout
321+ || (pipeMaxItemsPerQuery > 0 && items >= pipeMaxItemsPerQuery ))) {
320322 try {
321323 output (writer , type , key , SimplePipeRequest .PIPE_STATUS_CONTINUE );
322324 lastPipeDataWritten = System .currentTimeMillis ();
0 commit comments