Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (38 sloc) 0.871 kb
#!/usr/bin/perl
use strict;
use warnings;
use Coro;
use Coro::AnyEvent;
use AnyEvent::CouchDB;
use Data::Dump 'pp';
my $couch = couch();
my $bad = couch('http://bad/');
my $done = AnyEvent->condvar;
sub p(&) {
$done->begin;
my $code = shift;
my $data;
eval { $data = $code->(); };
if ($@) {
print $@, "\n";
} else {
print pp($data), "\n";
}
$done->end;
}
async { print "hello, world\n" };
for (1 .. 4) {
async { p { ($couch->info->recv) } };
async { p { ($couch->all_dbs->recv) } };
async { p { ($bad->info->recv) } };
async { p { ($bad->all_dbs->recv) } };
}
async { print "hello, again, world\n" };
async { print "*** please be patient, and let the bad requests timeout. ***\n" };
async {
$done->recv;
print "----\n";
print "Did you see how the bad requests didn't stop the good requests?\n";
exit;
};
schedule;
Jump to Line
Something went wrong with that request. Please try again.