added do_high to execute German function as high_priority one
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Oct 2011 11:34:34 +0000 (13:34 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Oct 2011 11:34:34 +0000 (13:34 +0200)
lib/APKPM/Gearman/Client.pm

index 2ab1b79..932bd5a 100644 (file)
@@ -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;