Skip to content

Commit

Permalink
Task got on_data field
Browse files Browse the repository at this point in the history
  • Loading branch information
p-alik committed Oct 27, 2016
1 parent 5e20b17 commit 4ef1954
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Gearman/Task.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ use fields (
# opts from client:
'uniq',
'on_complete',
'on_data',
'on_fail',
'on_exception',
'on_retry',
Expand Down Expand Up @@ -416,6 +417,18 @@ sub status {
$self->{on_status}->($nu, $de);
} ## end sub status

=head2 data()
=cut

sub data {
my Gearman::Task $task = shift;
return if $task->{is_finished};
my $result_ref = shift;

$task->{on_data}->($result_ref) if $task->{on_data};
} ## end sub data

=head2 handle()
getter
Expand Down

0 comments on commit 4ef1954

Please sign in to comment.