From: Dobrica Pavlinusic Date: Tue, 4 Oct 2011 11:34:34 +0000 (+0200) Subject: added do_high to execute German function as high_priority one X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=a7dc6e088d22d80a0b8fa74e8d9b6316483babfa;p=APKPM.git added do_high to execute German function as high_priority one --- diff --git a/lib/APKPM/Gearman/Client.pm b/lib/APKPM/Gearman/Client.pm index 2ab1b79..932bd5a 100644 --- a/lib/APKPM/Gearman/Client.pm +++ b/lib/APKPM/Gearman/Client.pm @@ -36,4 +36,15 @@ sub do { return JSON::XS::decode_json $$ret; } +sub do_high { + my ( $self, $func, $args ) = @_; + warn "# do_high ",dump( $func,$args ); + + my $task = Gearman::Task->new( $func, \$args, { high_priority => 1 } ); + + my $ret = $self->gc->do_task( $task ); + warn "## $func $args = ",dump($ret); + return $$ret =~ m/^{/ ? JSON::XS::decode_json($$ret) : $$ret; +} + 1;