Permalink
Browse files

try to prevent session timeout errors on remote render calls

  • Loading branch information...
lstein committed Nov 2, 2012
1 parent 059c2ca commit 53f719f4d4b62c2ac44c615b27cf1150f4e04475
@@ -159,13 +159,18 @@ sub adjust_configuration {
warn "adjust_configuration(@potential_instances)";
my @instances = grep {$_->isa('VM::EC2::Instance')} @potential_instances;
- my @addresses = map {$_->privateDnsName} @instances;
- warn "Adding slaves at address @addresses"if @addresses;
- my @a = map {("http://$_:8101",
- "http://$_:8102",
- "http://$_:8103")} @addresses;
- my @args = map {('--set'=> "$_") } @a;
- system 'sudo',CONFIGURE_SLAVES,@args;
+ if (@instances) {
+ my @addresses = grep {$_} map {$_->privateDnsName} @instances;
+ return unless @addresses;
+ warn "Adding slaves at address @addresses";
+ my @a = map {("http://$_:8101",
+ "http://$_:8102",
+ "http://$_:8103")} @addresses;
+ my @args = map {('--set'=> "$_") } @a;
+ system 'sudo',CONFIGURE_SLAVES,@args;
+ } else {
+ system 'sudo',CONFIGURE_SLAVES,'--set','';
+ }
}
sub terminate_instances {
@@ -106,6 +106,10 @@ sub ACTION_render_panels {
return (204,'text/plain',undef) unless $seg;
my $source = $render->data_source;
$render->init_plugins();
+
+ # no state changing occurs after this
+ $self->session->unlock;
+
my $html = $render->render_panels($seg,{overview => $source->show_section('overview'),
regionview => $source->show_section('region'),
detailview => $source->show_section('detail')});
@@ -21,6 +21,7 @@ use constant TRUE => 1;
use constant DEBUG => 0;
use constant DEBUGGING_RECTANGLES => 0; # outline the imagemap
use constant BENCHMARK => 0;
+use constant SLAVE_RETRIES => 2;
use constant DEFAULT_EMPTYTRACKS => 0;
use constant PAD_DETAIL_SIDES => 10;
@@ -831,6 +832,7 @@ sub run_remote_requests {
$requests->{$_}->lock(); # flag that request is in process
}
+ my $tries = 0;
FETCH: {
my $request = POST ($url,
Content_Type => 'form-data',
@@ -885,7 +887,7 @@ sub run_remote_requests {
if ($alternate_url) {
warn "retrying fetch of @labels with $alternate_url";
$url = $alternate_url;
- redo FETCH;
+ redo FETCH if $tries++ < SLAVE_RETRIES;
}
$response_line =~ s/^\d+//; # get rid of status code

0 comments on commit 53f719f

Please sign in to comment.