Changeset 8012
- Timestamp:
- 03/17/08 11:42:21 (5 years ago)
- Location:
- lang/perl/App-MadEye/trunk
- Files:
-
- 2 modified
-
config.yaml (modified) (1 diff)
-
lib/App/MadEye/Plugin/Worker/Gearman.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-MadEye/trunk/config.yaml
r8011 r8012 17 17 config: 18 18 fork_num: 3 19 task_timeout: 20 20 child_timeout: 7 19 21 gearman_servers: 20 22 - 127.0.0.1 -
lang/perl/App-MadEye/trunk/lib/App/MadEye/Plugin/Worker/Gearman.pm
r8011 r8012 16 16 __PACKAGE__->mk_accessors(qw/task_set child_pids gearman_client/); 17 17 18 our $TASK_TIMEOUT = 60; # TODO: configurable19 18 our $CHILD_TIMEOUT = 60; # TODO: configurable 20 19 … … 65 64 'watch', 66 65 freeze($args), +{ 67 timeout => $ TASK_TIMEOUT,66 timeout => $self->task_timeout(), 68 67 on_fail => sub { 69 68 warn "GEARMAN ERROR: " . Dump($args); … … 136 135 137 136 $context->log( debug => "watching $args->{target} by $args->{plugin}" ); 138 139 137 my $result = \undef; 140 timeout $ TASK_TIMEOUT, "watching $args->{target} $args->{plugin}", sub {138 timeout $self->task_timeout(), "watching $args->{target} $args->{plugin}", sub { 141 139 if ( my $message = $args->{plugin}->is_dead( $args->{target} ) ) { 142 140 $result = +{ … … 151 149 ); 152 150 153 timeout $ CHILD_TIMEOUT, 'work child', sub {151 timeout $self->child_timeout(), 'work child', sub { 154 152 $worker->work while 1; 155 153 }; 154 } 155 156 sub task_timeout { 157 my $self = shift; 158 $self->config->{config}->{task_timeout} || 10; 159 } 160 161 sub child_timeout { 162 my $self = shift; 163 $self->config->{config}->{child_timeout} || 60; 156 164 } 157 165 … … 177 185 - type: str 178 186 required: yes 187 task_timeout: 188 type: int 189 required: no 190 child_timeout: 191 type: int 192 required: no 179 193 180 194 =head1 AUTHOR
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)