I am using $r->pool->cleanup_register(&cleanup) to operate a subroutine following a page continues to be processed and printed towards the client. My hope could be that the client would begin to see the complete page, and Apache could keep doing some processing without anyone's knowledge that can take a couple of seconds.

However the client browser dangles until cleanup sub has came back. It is possible to method of getting apache to finalise the bond using the client before my code has came back?

I am convinced I have carried this out before, however i aren't able to find it again.

Make use of a job queue system and perform the lengthy operation completely asynchronously -- just schedule the operation throughout the net request. Employment queue also handles peak load situations much better than doing something costly inside the web server processes themselves.

You need to flush the buffer. It does not finalize the bond, however your client might find the output prior to the task completes.

sub handler change


      $r->rflush # send the headers out


      return Apache2::Const::OK