CPAN-Testers-API
view release on metacpan or search on metacpan
lib/CPAN/Testers/API.pm view on Meta::CPAN
#pod Stream a L<DBIx::Class::ResultSet> object to the browser. This prevents
#pod problems with proxy servers and CDNs timing out waiting for data. This
#pod uses L<Mojolicious::Controller/write_chunk> to transfer a chunked
#pod response. If there are no results in the ResultSet object, this method
#pod returns a 404 error.
#pod
#pod C<$processor> is an optional subref that allows for processing each row
#pod before it is written. Use this to translate column names or values into
#pod the format the API expects.
#pod
#pod For this to work usefully behind Fastly, we also need to enable streaming
#pod miss so that Fastly streams the data to the end-user as it gets it:
#pod L<https://docs.fastly.com/guides/performance-tuning/improving-caching-performance-with-large-files#streaming-miss>.
#pod
#pod =cut
sub stream_rs {
my ( $c, $rs, $process ) = @_;
$process //= sub { shift };
my $wrote_open = 0;
my $written = 0;
my @to_write;
lib/CPAN/Testers/API.pm view on Meta::CPAN
Stream a L<DBIx::Class::ResultSet> object to the browser. This prevents
problems with proxy servers and CDNs timing out waiting for data. This
uses L<Mojolicious::Controller/write_chunk> to transfer a chunked
response. If there are no results in the ResultSet object, this method
returns a 404 error.
C<$processor> is an optional subref that allows for processing each row
before it is written. Use this to translate column names or values into
the format the API expects.
For this to work usefully behind Fastly, we also need to enable streaming
miss so that Fastly streams the data to the end-user as it gets it:
L<https://docs.fastly.com/guides/performance-tuning/improving-caching-performance-with-large-files#streaming-miss>.
=head1 CONFIG
This application can be configured by setting the C<MOJO_CONFIG>
environment variable to the path to a configuration file. The
configuration file is a Perl script containing a single hash reference,
like:
# api.conf
{
( run in 0.231 second using v1.01-cache-2.11-cpan-a5abf4f5562 )