--- a/lib/CrashTest/Decode/Queue/Gearman.pm Sat Aug 02 23:48:50 2014 +0200
+++ b/lib/CrashTest/Decode/Queue/Gearman.pm Sun Aug 03 16:45:34 2014 +0200
@@ -12,16 +12,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package CrashTest::Decode::Queue::Gearman;
-
-use AnyEvent::Gearman::Client;
-
-use strict;
-use warnings;
+use Mojo::Base -strict;
+use Gearman::Client;
sub new {
my ($class, $config, $dumperconfig, $storage) = @_;
my $self = {};
- $self->{gearman} = AnyEvent::Gearman::Client->new(job_servers => $config->{GearmanServers});
+ $self->{gearman} = Gearman::Client->new(job_servers => $config->{GearmanServers});
bless ($self, $class);
return $self;
}
@@ -31,15 +28,9 @@
my $json = Mojo::JSON->new;
my $args = $json->encode({ file => $file->slurp, params => $paramshash, uuid => $uuidstr });
- $self->{gearman}->add_task(
- dump_decode => $args,
- on_complete => sub {
- my $taskres = $_[1];
- &$cb($json->decode($taskres));
- },
- on_fail => sub {
- }
- );
+ $self->{gearman}->dispatch_background('dump_decode', $args);
+
+ &$cb({ status => "backgrounded" });
}
1;