[jifty-devel] $m->flush_buffer question
Henry Baragar
Henry.Baragar at instantiated.ca
Thu Jul 7 16:35:44 EDT 2011
Hi,
I'm trying to download 500MB of data (3M records) and would like to flush the
output buffer every 1K records so that the browser (or web server) does not
time out. With a plain Mason application calling $m->flush_buffer does the
trick, but this does not seem to be working in Jifty 1.10518.
Do I have to do something else in Jifty to get it to flush the output
midstream?
Regards,
Henry
--
Henry Baragar
Instantiated Software
ps. Here is my template file:
<%args>
$csv
</%args>
<%init>
Jifty->web->response->content_type('text/csv');
$m->clear_buffer;
my @field = @{$csv->{fields}};
my $formatter = Text::xSV->new();
$m->print($formatter->format_row(@{$csv->{headers}}));
my $count = 1;
while (my $transaction = $csv->next) {
$m->print($formatter->format_row(map {$transaction->$_} @field));
if (0 == $count++ % 1000) {
$m->flush_buffer;
Jifty->handler->buffer->flush_output;
}
}
</%init>
<%once>
use Text::xSV;
</%once>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jifty.org/pipermail/jifty-devel/attachments/20110707/cf82964c/attachment.html>
More information about the jifty-devel
mailing list