#!/opt/bin/perl BEGIN { require "common.pl" } our ($TXN, %stat, $db_env, $TPB, $db_info, $TODAY); use common::sense; our $NUM_DOWNLOADERS = 2; # minimum 2 our $db_http = table "http"; our $db_torrent = table "torrent"; our $TODO; ############################################################################# my $pool = new Coro::Channel 10000; my @pool = map { async { while (my $args = $pool->get) { my $cb = pop @$args; $cb->(@$args); } } } 1..1; sub pool(&@) { $pool->put ([@_]); } sub http_extract($) { $_[0] =~ / id='NumComments'>(\d+)\n"; $1 } my $finish = new Coro::Channel 100; my @finishers = async { { my $txn; $Coro::current->swap_sv (\$TXN, \$txn); } while (my $job = $finish->get) { # $TXN = $db_env->txn_begin; my ($i, $html, $torrent) = @$job; $html =~ s/^.*?Details for this torrent//s; $html =~ s/