This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: How to close connect and continue processing?
From: "Vladislav Safronov" <vlads@comptek.ru>
Date: Thu, 14 Sep 2000 13:43:32 +0400
Hi,
After user request my script should say that the request is accepted and
continue processing user data (it takes a time) so I want to tell the
browser
that all data is sent. I searched mod_perl guide but I didn't find such code
snippet.
Could you send me such example?
===
Subject: Re: How to close connect and continue processing?
From: Matt Sergeant <matt@sergeant.org>
Date: Thu, 14 Sep 2000 11:15:42 +0100 (BST)
On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> Hi,
>
> After user request my script should say that the request is accepted and
> continue processing user data (it takes a time) so I want to tell the
> browser
> that all data is sent. I searched mod_perl guide but I didn't find such code
> snippet.
> Could you send me such example?
$r->register_cleanup(\&do_big_work);
===
Subject: Re: How to close connect and continue processing?
From: Matt Sergeant <matt@sergeant.org>
Date: Thu, 14 Sep 2000 11:17:35 +0100 (BST)
On Thu, 14 Sep 2000, Matt Sergeant wrote:
> On Thu, 14 Sep 2000, Vladislav Safronov wrote:
>
> > Hi,
> >
> > After user request my script should say that the request is accepted and
> > continue processing user data (it takes a time) so I want to tell the
> > browser
> > that all data is sent. I searched mod_perl guide but I didn't find such code
> > snippet.
> > Could you send me such example?
>
> $r->register_cleanup(\&do_big_work);
I should have mentioned that this is far from a perfect solution (cue
Stas) as it ties up a mod_perl process. See the guide for alternate
solutions.
===
Subject: Re: How to close connect and continue processing?
From: Stas Bekman <stas@stason.org>
Date: Thu, 14 Sep 2000 12:34:08 +0200 (CEST)
On Thu, 14 Sep 2000, Matt Sergeant wrote:
> On Thu, 14 Sep 2000, Matt Sergeant wrote:
>
> > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> >
> > > Hi,
> > >
> > > After user request my script should say that the request is accepted and
> > > continue processing user data (it takes a time) so I want to tell the
> > > browser
> > > that all data is sent. I searched mod_perl guide but I didn't find such code
> > > snippet.
> > > Could you send me such example?
> >
> > $r->register_cleanup(\&do_big_work);
>
> I should have mentioned that this is far from a perfect solution (cue
> Stas) as it ties up a mod_perl process. See the guide for alternate
> solutions.
Like Matt has said, this used mostly for light things like logging or
process killing (Apache::{SizeLimit|GTopLimit}). See the performance
chapter for forking techniques for heavy jobs:
http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess
===
Subject: RE: How to close connect and continue processing?
From: "Vladislav Safronov" <vlads@comptek.ru>
Date: Thu, 14 Sep 2000 15:12:23 +0400
I read the guide and I think the best is just add "&" :)
(how could I forget it!)
..
system("myprog la la &");
print "</html>";
# end
===
Subject: RE: How to close connect and continue processing?
From: Stas Bekman <stas@stason.org>
Date: Thu, 14 Sep 2000 13:30:33 +0200 (CEST)
On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> I read the guide and I think the best is just add "&" :)
> (how could I forget it!)
> ..
> system("myprog la la &");
> print "</html>";
> # end
True, but what happens if your program tries to print something. You've
all in/out/err streams inherited, where in/out are tied to a socket. You
must close them at the beginning of the external script.
Anyway, it might be neater to use &, but performance wise is not, since
you spawn a shell. Of course for the heavily loaded systems. Fork is
faster.
===