Skip to content

Instantly share code, notes, and snippets.

@athomason
Created May 19, 2011 23:09
Show Gist options
  • Save athomason/981997 to your computer and use it in GitHub Desktop.
Save athomason/981997 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use AnyEvent;
use AnyEvent::Gearman::Client;
my $count = shift || 1000;
my $client = AnyEvent::Gearman::Client->new(job_servers => ['127.0.0.1:7003']);
my $cv = AnyEvent->condvar;
my $done = 0;
sub done {
$cv->send if ++$done > $count;
new();
}
sub new {
$client->add_task(
test => 1 =>
on_complete => \&done,
on_error => \&done,
);
}
new();
$cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment