<%= form_for gnuplot => begin %>
<%= text_area 'sql', cols => 80, rows => 5 %>
<br>with <%= select_field with => [qw(dots points steps lines)], 'dots' %>
- timeout <%= text_field 'timeout', value => 5, style => 'width: 2em' %>s
+ timeout <%= input_tag 'timeout', type => 'number', style => 'width: 3em' %>s
<%= submit_button 'execute' %>
<%= check_box 'include_gnuplot' => 1, title => 'include gnuplot dump' %>
<% end %>
my $self = shift;
my $sql = $self->param('sql');
+
+ if ( my $timeout = $self->param('timeout') ) {
+ warn "set timout to $timeout";
+ $gearman->timeout( $timeout );
+ } else {
+ $self->param( timeout => $gearman->timeout );
+ }
+
return $self->render('gnuplot', img => '', gnuplot => '') unless $sql;
# re-format SQL
$sql =~ s/\s+(from|where|order|limit|join)/\n$1/gs;
$self->param( sql => $sql );
- $gearman->timeout( $self->param('timeout') );
my $ret = $gearman->req( 'SUBMIT_JOB', 'Store_sql', '', $sql );
die "no result for $sql" unless $ret;