view release on metacpan or search on metacpan
last;
}
}
$r->assbackwards(1);
$r->connection->keepalive(1);
$r->connection->keepalives($r->connection->keepalives+1);
$r->print("ICY ". ($range ? 206 : 200) ." OK$CRLF");
$r->print("icy-notice1: <BR>This stream requires a shoutcast/icecast compatible player.<BR>$CRLF");
$r->print("icy-notice2: Apache::MP3<BR>$CRLF");
$r->print("icy-name: $description$CRLF");
view all matches for this distribution
view release on metacpan or search on metacpan
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest;
use File::Spec::Functions qw(catfile tmpdir);
Apache::TestRequest::user_agent(keep_alive => 1);
plan tests => 3, need 'HTML::HeadParser';
my $test_file = catfile qw(Reload Test.pm);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Scoreboard.pm view on Meta::CPAN
"_" Waiting for Connection
"S" Starting up
"R" Reading Request
"W" Sending Reply
"K" Keepalive (read)
"D" DNS Lookup
"C" Closing connection
"L" Logging
"G" Gracefully finishing
"I" Idle cleanup of worker
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/bin/conf.pl view on Meta::CPAN
CustomLog "logs/access_log" combined
LogFormat "\%h \%{LOCATION_ID}e \%{USER_ID}e \%t \\"\%r\\" \%>s \%b \\"\%{Referer}i\\" \\"\%{User-Agent}i\\" \\"\%{SID}e\\" \\"\%{DOMAIN_NAME}e\\" \\"\%{POST_DATA}e\\"" sdnfw
ServerSignature Off
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
AddType application/x-httpd-php .php
view all matches for this distribution
view release on metacpan or search on metacpan
SearchEngineLog.pm view on Meta::CPAN
init ();
return 1;
#List of subroutines:
# check_alive_dbi
# check_regexen
# cleanup
# connect_dbi
# db_save
# handler
# init
sub check_alive_dbi
##########################################################################
# Checks wether DB connection is alive by pinging it periodically. #
# Reconnects if neccessary. #
# #
# Arguments: #
# 0: Apache::Log object #
# #
SearchEngineLog.pm view on Meta::CPAN
return $retval;
}
sub cleanup
##########################################################################
# Checks wether DB connection is alive by pinging it periodically. #
# Reconnects if neccessary. #
# #
# Arguments: #
# None #
# #
SearchEngineLog.pm view on Meta::CPAN
if (defined $params{$field})
{
$SERVER->{$server} = $field;
check_alive_dbi ($l);
my $sth = $DBH->prepare ("INSERT INTO config (domain, field) VALUES (?, ?)");
$sth->execute ($server, $field);
$sth->finish ();
SearchEngineLog.pm view on Meta::CPAN
push (@terms, $term);
}
$l->debug ("Apache::SearchEngineLog: Saving to database");
check_alive_dbi ($l) or return 1;
db_save ($server, $uri, $virtual, @terms);
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
demo/httpdconf/httpd.sec1.conf view on Meta::CPAN
# libraries it uses) leak memory or other resources. On most systems, this
# isn't really needed, but a few (such as Solaris) do have notable leaks
# in the libraries. For these platforms, set to something like 10000
# or so; a setting of 0 means unlimited.
#
# NOTE: This value does not include keepalive requests after the initial
# request per connection. For example, if a child process handles
# an initial request and 10 subsequent "keptalive" requests, it
# would only count as 1 request towards this limit.
#
MaxRequestsPerChild 0
#
view all matches for this distribution
view release on metacpan or search on metacpan
t/Apache-Session-Browseable-Redis.t view on Meta::CPAN
# Test lazy cleanup of orphan index entries in searchOn/searchOnExpr
$r->flushall;
my %session_lz1;
tie %session_lz1, $package, undef, $args;
$session_lz1{uid} = 'alive';
$session_lz1{mail} = 'alive@test.com';
my $id_lz1 = $session_lz1{_session_id};
untie %session_lz1;
my %session_lz2;
tie %session_lz2, $package, undef, $args;
$session_lz2{uid} = 'alive';
$session_lz2{mail} = 'dead@test.com';
my $id_lz2 = $session_lz2{_session_id};
untie %session_lz2;
# Both should be in uid_alive index
ok( $r->sismember( "uid_alive", $id_lz1 ), "Session lz1 in uid_alive index" );
ok( $r->sismember( "uid_alive", $id_lz2 ), "Session lz2 in uid_alive index" );
# Delete lz2 directly from Redis (simulates TTL expiration)
$r->del($id_lz2);
# searchOn should return only lz1 and clean orphan lz2 from index
$hash = $package->searchOn( $args, 'uid', 'alive' );
is( keys %$hash, 1, "searchOn returns only the surviving session" );
ok( exists $hash->{$id_lz1}, "searchOn returns lz1" );
ok( !$r->sismember( "uid_alive", $id_lz2 ),
"searchOn lazy cleanup removed orphan lz2 from index" );
ok( $r->sismember( "uid_alive", $id_lz1 ),
"searchOn kept valid lz1 in index" );
# Test lazy cleanup in searchOnExpr
my %session_lz3;
tie %session_lz3, $package, undef, $args;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Sling/Authn.pm view on Meta::CPAN
#}}}
#{{{sub user_agent
sub user_agent {
my ( $class, $referer ) = @_;
my $lwp_user_agent = LWP::UserAgent->new( keep_alive => 1 );
push @{ $lwp_user_agent->requests_redirectable }, 'POST';
my $tmp_cookie_file_name;
$lwp_user_agent->cookie_jar( { file => \$tmp_cookie_file_name } );
if ( defined $referer ) {
$lwp_user_agent->default_header( 'Referer' => $referer );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Solr.pm view on Meta::CPAN
$self->{AS_sversion} = $args->{server_version} || LATEST_SOLR_VERSION;
$self->{AS_retry_wait} = $args->{retry_wait} // 5; # seconds
$self->{AS_retry_max} = $args->{retry_max} // 60;
$http_agent = $self->{AS_agent} =
$args->{agent} || $http_agent || LWP::UserAgent->new(keep_alive=>1);
weaken $http_agent;
$self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
proxy.config.http.global_user_agent_header
proxy.config.http.insert_age_in_response
proxy.config.http.insert_request_via_str
proxy.config.http.insert_response_via_str
proxy.config.http.insert_squid_x_forwarded_for
proxy.config.http.keep_alive_enabled
proxy.config.http.keep_alive_no_activity_timeout_in
proxy.config.http.keep_alive_no_activity_timeout_out
proxy.config.http.keep_alive_post_out
proxy.config.http.log_spider_codes
proxy.config.http.negative_caching_enabled
proxy.config.http.negative_caching_lifetime
proxy.config.http.negative_revalidating_enabled
proxy.config.http.negative_revalidating_lifetime
proxy.config.http.no_dns_just_forward_to_parent
proxy.config.http.no_origin_server_dns
proxy.config.http.normalize_ae_gzip
proxy.config.http.number_of_redirections
proxy.config.http.origin_max_connections
proxy.config.http.origin_min_keep_alive_connections
proxy.config.http.origin_server_pipeline
proxy.config.http.parent_proxies
proxy.config.http.parent_proxy.connect_attempts_timeout
proxy.config.http.parent_proxy.fail_threshold
proxy.config.http.parent_proxy.file
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
proxy.config.http.send_http11_requests
proxy.config.http.server_max_connections
proxy.config.http.server_other_ports
proxy.config.http.server_port
proxy.config.http.server_port_attr
proxy.config.http.session_auth_cache_keep_alive_enabled
proxy.config.http.share_server_sessions
proxy.config.http.slow.log.threshold
proxy.config.http.snarf_username_from_authorization
proxy.config.http.connect_ports
proxy.config.http.transaction_active_timeout_in
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
proxy.config.plugin.plugin_mgmt_dir
proxy.config.prefetch.child_port
proxy.config.prefetch.config_file
proxy.config.prefetch.default_data_proto
proxy.config.prefetch.default_url_proto
proxy.config.prefetch.keepalive_timeout
proxy.config.prefetch.max_object_size
proxy.config.prefetch.max_recursion
proxy.config.prefetch.prefetch_enabled
proxy.config.prefetch.push_cached_objects
proxy.config.prefetch.redirection
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TestClient.pm view on Meta::CPAN
#this module provides some fallback for when libwww-perl is not installed
#it is by no means an LWP replacement, just enough for very simple requests
#this module does not and will never support certain features such as:
#file upload, http/1.1 (byteranges, keepalive, etc.), following redirects,
#authentication, GET body callbacks, SSL, etc.
use strict;
use warnings FATAL => 'all';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/VMonitor.pm view on Meta::CPAN
%Apache::VMonitor::longflags = (
"_" => "Waiting for Connection",
"S" => "Starting up",
"R" => "Reading Request",
"W" => "Sending Reply",
"K" => "Keepalive (read)",
"D" => "DNS Lookup",
"C" => "Closing connection",
"L" => "Logging",
"G" => "Gracefully finishing",
"I" => "Idle cleanup of worker",
lib/Apache/VMonitor.pm view on Meta::CPAN
<code><b>_</b></code> = Waiting for Connection<BR>
<code><b>S</b></code> = Starting up<BR>
<code><b>R</b></code> = Reading Request<BR>
<code><b>W</b></code> = Sending Reply<BR>
<code><b>K</b></code> = Keepalive (read)<BR>
<code><b>D</b></code> = DNS Lookup<BR>
<code><b>C</b></code> = Closing connection<BR>
<code><b>L</b></code> = Logging<BR>
<code><b>G</b></code> = Gracefully finishing<BR>
<code><b>I</b></code> = Idle cleanup of worker<BR>
view all matches for this distribution
view release on metacpan or search on metacpan
use Apache::TestUtil;
use Apache::TestRequest 'GET_BODY';
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(
keep_alive => 1,
timeout => 30,
requests_redirectable => []
);
plan tests => 7;
view all matches for this distribution
view release on metacpan or search on metacpan
demo/conf/httpd-perl.conf view on Meta::CPAN
CustomLog logs/access_log combined
ServerSignature On
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/API.pm view on Meta::CPAN
use parent qw( Module::Generic );
use vars qw( $VERSION $DEBUG @EXPORT $USE_RFC_ERROR );
use version;
use Encode ();
# use Apache2::Const qw( :common :http );
use Apache2::Const -compile => qw( :cmd_how :common :config :conn_keepalive :context :filter_type :http :input_mode :log :methods :mpmq :options :override :platform :remotehost :satisfy :types :proxy );
use APR::Const -compile => qw( :common :error :fopen :filepath :fprot :filetype :finfo :flock :hook :limit :lockmech :poll :read_type :shutdown_how :socket :status :table :uri );
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::ServerUtil ();
use Apache2::RequestUtil ();
lib/Apache2/API.pm view on Meta::CPAN
display this message
=item C<-http11>
run all tests with C<HTTP/1.1> (keep alive) requests
=item C<-no-httpd>
run the tests without configuring or starting httpd
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/AuthCASpbh/Authn.pm view on Meta::CPAN
};
$service = Apache2::Util::escape_path($service, $r->pool);
my $st = $q->param('ticket');
if ($st) {
my $ua = LWP::UserAgent->new(timeout => 10, keep_alive => 1);
my $proxy_allow = cfg_value($dir_cfg, 'ProxyAllow');
my $proxy_allow_re = cfg_value($dir_cfg, 'ProxyAllowRE');
my $validate_url = cfg_value($dir_cfg, 'ServerURL') .
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/AuthCookieDBImg.pm view on Meta::CPAN
return undef;
}
# CSA Patch - Use global var
# needed later for authen_sess_key
# to keep cookie alive
#
# Extra data can be put in credential_2, _3, etc.
# my @extra_data = @credentials;
@Extra_Data = @credentials;
view all matches for this distribution
view release on metacpan or search on metacpan
AuthenNTLM.pm view on Meta::CPAN
=head2 PerlSetVar ntlmsemtimeout
This set the timeout value used to wait for the semaphore. The default is two seconds.
It is very small because during the time Apache waits for the semaphore, no other
authentication request can be sent to the windows server. Also Apache2::AuthenNTLM
only asks the windows server once per keep-alive connection, this timeout value
should be as small as possible.
=head2 PerlSetVar splitdomainprefix
If set to 1, $self -> map_user ($r) will return "username"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ClickPath/Store.pm view on Meta::CPAN
my $cfg=Apache2::Module::get_config( __PACKAGE__, $r->server );
my $d=$cfg->{"ClickPathStoreDirectory"};
if( $cfg->{"ClickPathStoreTimeout"} ) {
# Call cleanup at the end of a connection. So keep-alive requests
# are served at full speed.
$r->connection->pool->cleanup_register( \&cleanup, [$r->connection, $cfg] )
unless( $r->connection->keepalives );
}
my ($what, $session, $k, $v, $param);
if( $r->main and # is subreq
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Filter/HTTPHeadersFixup.pm view on Meta::CPAN
mydebug "filter context init";
$ctx = {
headers => [],
done_with_headers => 0,
seen_body_separator => 0,
keepalives => $f->c->keepalives,
};
# since we are going to manipulate the reference stored in
# ctx, it's enough to store it only once, we will get the same
# reference in the following invocations of that filter
$f->ctx($ctx);
return $ctx;
}
my $c = $f->c;
if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE &&
$ctx->{done_with_headers} &&
$c->keepalives > $ctx->{keepalives}) {
mydebug "a new request resetting the input filter state";
$ctx->{headers} = [];
$ctx->{done_with_headers} = 0;
$ctx->{seen_body_separator} = 0;
$ctx->{keepalives} = $c->keepalives;
}
return $ctx;
}
view all matches for this distribution
view release on metacpan or search on metacpan
ModProxyPerlHtml.pm view on Meta::CPAN
use Apache2::RequestRec;
use Apache2::RequestUtil;
use APR::Table;
use APR::URI;
use base qw(Apache2::Filter);
use Apache2::Const -compile => qw(OK DECLINED :conn_keepalive);
use constant BUFF_LEN => 8000;
use Apache2::ServerRec;
use Apache2::URI;
ModProxyPerlHtml.pm view on Meta::CPAN
}
# Thing we do on all invocations
my $ctx = $f->ctx;
while ($f->read(my $buffer, BUFF_LEN)) {
$ctx->{data} .= $buffer;
$ctx->{keepalives} = $f->c->keepalives;
$f->ctx($ctx);
}
# Thing we do at end
if ($f->seen_eos) {
my $parsed_uri = $f->r->construct_url();
ModProxyPerlHtml.pm view on Meta::CPAN
$f->ctx($ctx);
# Dump datas out
$f->print($f->ctx->{data});
my $c = $f->c;
if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE && $ctx->{data} && $c->keepalives > $ctx->{keepalives}) {
if ($debug) {
Apache2::ServerRec::warn("[ModProxyPerlHtml] Cleaning context for keep alive request");
}
$ctx->{data} = '';
$ctx->{pattern} = ();
$ctx->{rewrite} = ();
$ctx->{excluded} = ();
$ctx->{rot13elements} = ();
$ctx->{contenttype} = '';
$ctx->{badcontenttype} = '';
$ctx->{keepalives} = $c->keepalives;
}
}
return Apache2::Const::OK;
view all matches for this distribution
view release on metacpan or search on metacpan
"Apache2::POST200". It repairs the application without having access to
it.
TODO
Caching
With a keep-alive connection the redirected request is most likely
to come in over the same connection. Thus, some caching in a
connection pnote would be good.
User check
Client IP checking may not be sufficient. The filter could check
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Proxy.pm view on Meta::CPAN
sub {
my $k = shift;
my $v = shift;
if ( $k =~ m/^connection/i ) {
$headers{$k} = 'keep-alive';
return 1;
}
# pass this header onto the remote request
$headers{$k} = $v;
lib/Apache2/Proxy.pm view on Meta::CPAN
# skip HTTP::Response inserted headers
next if substr( lc($key), 0, 6 ) eq 'client';
# let apache set these
next if substr( lc($key), 0, 10 ) eq 'connection';
next if substr( lc($key), 0, 10 ) eq 'keep-alive';
# some headers have an unecessary newline appended so chomp the value
chomp( $headers->{$key} );
if ( $headers->{$key} =~ m/\n/ ) {
$headers->{$key} =~ s/\n/ /g;
lib/Apache2/Proxy.pm view on Meta::CPAN
Host => $url->host,
PeerAddr => $host,
PeerPort => $port
) || die $@;
# set keep alive
$http->keep_alive(1);
# reinforce the point (Net::HTTP adds PeerPort to host during
# new())
$http->host( $url->host );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/SSI.pm view on Meta::CPAN
$f->ctx( $ctx );
return( &Apache2::Const::OK );
}
# Let's behave well as per the doc
if( $f->c->keepalive == &Apache2::Const::CONN_KEEPALIVE )
{
$r->log->debug( "${class} [PerlOutputFilterHandler]: KeepAlive count (", $f->c->keepalive, ") reached the threshold of '", &Apache2::Const::CONN_KEEPALIVE, "'." ) if( $debug > 0 );
$ctx->{data} = '';
$f->ctx( $ctx );
}
my $size = length( $html );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ScoreBoardFile.pm view on Meta::CPAN
"_" Waiting for Connection
"S" Starting up
"R" Reading Request
"W" Sending Reply
"K" Keepalive (read)
"D" DNS Lookup
"C" Closing connection
"L" Logging
"G" Gracefully finishing
"I" Idle cleanup of worker
lib/Apache2/ScoreBoardFile.pm view on Meta::CPAN
count the number of workers in C<Sending Reply> state
=item C<K>
count the number of workers in C<Keepalive (read)> state
=item C<D>
count the number of workers in C<DNS Lookup> state
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ScoreboardDumper.pm view on Meta::CPAN
our %Key = (
'_' => 'Waiting for Connection',
'S' => 'Starting up',
'R' => 'Reading Request',
'W' => 'Sending Reply',
'K' => 'Keepalive (read)',
'D' => 'DNS Lookup',
'C' => 'Closing connection',
'L' => 'Logging',
'G' => 'Gracefully finishing',
'I' => 'Idle cleanup of worker',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Translation.pm view on Meta::CPAN
use APR::Table ();
use APR::SockAddr ();
use ModPerl::Util ();
use attributes;
use Apache2::Const -compile=>qw{:common :http
:conn_keepalive
:methods
:override
:satisfy
:types
:proxy
lib/Apache2/Translation.pm view on Meta::CPAN
tie $REQUEST, 'Apache2::Translation::_r', member=>'the_request';
tie $HEADERS, 'Apache2::Translation::_r', member=>'headers_in';
tie $C, 'Apache2::Translation::_r', member=>'connection';
tie $CLIENTIP, 'Apache2::Translation::_r', member=>'connection->remote_ip';
tie $KEEPALIVE, 'Apache2::Translation::_r', member=>'connection->keepalive';
tie $MATCHED_URI, 'Apache2::Translation::n', member=>'uri';
tie $MATCHED_PATH_INFO, 'Apache2::Translation::n', member=>'pathinfo';
tie $KEY, 'Apache2::Translation::n', member=>'key';
tie $DEBUG, 'Apache2::Translation::n', member=>'debug';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTPD/Bench/ApacheBench.pm view on Meta::CPAN
$self->{repeat} ||= 1;
$self->{priority} ||= "equal_opportunity";
$self->{buffersize} ||= 262144;
$self->{request_buffersize} ||= 8192;
$self->{timelimit} = undef if ! defined $self->{timelimit};
$self->{keepalive} = 0 if ! defined $self->{keepalive};
$self->{memory} = 1 if ! defined $self->{memory};
}
##################################################
lib/HTTPD/Bench/ApacheBench.pm view on Meta::CPAN
my ($self, $arg) = @_;
$self->{repeat} = $arg if $arg;
return $self->{repeat};
}
sub keepalive {
my ($self, $arg) = @_;
$self->{keepalive} = $arg if $arg;
return $self->{keepalive};
}
sub timelimit {
my ($self, $arg) = @_;
$self->{timelimit} = $arg if $arg;
lib/HTTPD/Bench/ApacheBench.pm view on Meta::CPAN
The number of times to repeat the request sequence in each run.
This can be overridden on a per-run basis (see below).
(default: B<1>)
=item $b->keepalive( 0|1 )
Whether or not to use HTTP Keep-Alive feature for requests configured in this
object. This can be overridden on a per-url/per-run basis (see below).
B<Warning>: If you configure runs which contain requests to more than one
hostname/port, be aware that setting $b->keepalive() may not improve
performance. See the discussion in the $run->keepalive() section for more
details.
(default: B<0>)
=item $b->timelimit( $sec_to_max_wait )
lib/HTTPD/Bench/ApacheBench.pm view on Meta::CPAN
no extra headers, one with 1 extra header, and one with 2 extra headers.
$run->request_headers([ undef, undef, "Extra-Header: bread",
"Extra-Header1: butter\r\nExtra-Header2: toaster" ])
=item $run->keepalive( \@keepalives )
Use HTTP Keep-Alive feature for the specified requests in this run. The
length of @keepalives should equal the length of @url_list, and it is
interpreted as an array of booleans, with undef indicating to use the
object default set by $b->keepalive(). Any true value in @keepalives will
result in a Keep-Alive HTTP request being sent for the corresponding URL.
To achieve full performance benefits from this feature, you need to be sure
your Keep-Alive requests are consecutive. If a non-Keep-Alive request or
a request for a different hostname or port immediately follows a Keep-Alive
lib/HTTPD/Bench/ApacheBench.pm view on Meta::CPAN
connection slots open and even though requests in @url_list will be sent
in order, there is no guarantee they will all use the same connection slot.
The HTTP Keep-Alive feature only yields performance benefits when consecutive
Keep-Alive requests use the same connection slot. Otherwise ApacheBench has
to close and re-open connections, resulting in the same performance as not
using keepalive() at all.
To guarantee consecutive Keep-Alive requests with $b->concurrency() > 1,
I recommend you either declare I<all> URLs in all runs as keepalive()
(this can be done by setting $b->keepalive( 1 ) and not overriding it by
calling keepalive() for any runs), or set $run->order( "depth_first" ) and
$b->priority( "run_priority" ). This is the only combination of configuration
options that guarantees consecutive, same-slot Keep-Alive requests
regardless of your concurrency setting.
For $b->concurrency() == 1, things are simpler. At any given time, there
is only one connection slot open, so just make sure your keepalive URLs are
consecutive within each run (if in "run_priority" mode), or that
equal-numbered repetitions of URLs in all runs are keepalive (if in
"equal_opportunity" mode), and be sure that all requests are to the
same hostname/port.
=item $run->timelimits( \@timelimits )
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Base/Daemon/Supervisor.pm view on Meta::CPAN
sub options { ... }
sub supervised_process {
my $self = shift;
# the main daemon process
while(1) {
# check if supervisor is alive, exit otherwise
$self->ping_supervisor;
# do something
...
}
}
lib/App/Base/Daemon/Supervisor.pm view on Meta::CPAN
=cut
=head2 supervised_process
The main daemon subroutine. Inside this subroutine you should periodically
check that supervisor is still alive using I<ping_supervisor> method. If
supervisor exited, daemon should also exit.
=cut
requires 'supervised_process';
lib/App/Base/Daemon/Supervisor.pm view on Meta::CPAN
=cut
=head2 $self->ping_supervisor
Should only be called from supervised process. Checks if supervisor is alive
and initiates shutdown if it is not.
=cut
sub ping_supervisor {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/BrowserUtils.pm view on Meta::CPAN
return [304,
$num_start_requests ? "All browsers already have processes" :
"Not ${which_action}ing any browsers"];
}
my (%alive, %not_alive);
if ($args{-dry_run}) {
%alive = %started;
} else {
for my $wait_time (2, 5, 10) {
%alive = ();
%not_alive = ();
log_trace "Checking if the started browsers are alive ...";
for my $browser (keys %pbs) {
if ($pbs{$browser}->alive) {
$alive{$browser}++;
} else {
$not_alive{$browser}++;
}
}
last if scalar(keys %alive) == $num_started;
}
}
my $num_alive = keys %alive;
my $num_not_alive = keys %not_alive;
my $status;
my $reason;
my $msg;
my $verb_started = $which_action eq 'restart' ? 'Started/restarted' : 'Started';
if ($num_alive == $num_started) {
$status = 200;
$reason = "OK";
$msg = "$verb_started ".join(", ", sort keys %alive);
} elsif ($num_alive == 0) {
$status = 500;
$reason = $msg = "Can't start any browser (".join(", ", %not_alive).")";
} else {
$status = 200;
$reason = "OK";
$msg = "$verb_started ".join(", ", sort keys %alive)."; but failed to start ".
join(", ", sort keys %not_alive);
}
$fail{$_} //= "Can't start" for keys %not_alive;
[$status, $msg, undef, {
'func.outputs' => \%outputs,
($which_action eq 'start' ? ('func.has_processes' => [sort keys %has_processes]) : ()),
'func.started' => [sort grep {!$terminated{$_}} keys %alive],
($which_action eq 'restart' ? ('func.restarted' => [sort grep {$terminated{$_}} keys %alive]) : ()),
'func.fail' => [sort keys %fail],
}];
}
$SPEC{start_browsers} = {
view all matches for this distribution