|
| > I can only guess at your problem because you never
>explained the
> nature of these "errors". Since the problem is
>identical with
> different DBI components, I'm guessing that you've
>reached a shell or
> system limit on the amount of resources you're allowed
>to consume.
>
> Talk to your system administrator about your system's
>resource limits.
Yes, Postgres max_connections=200, I just need to make
about 180 DBI sessions and use it.
As I said before, I use Randal Schwartz`s script
(http://www.stonehenge.com/merlyn/Li...l41.listing.txt).
I`ve added DBI package to save all extracted links to DBI.
Each time when I add a query to DBI I create new session
and then there are more than 197 sessions there are
errors...
Code below:
________________________
....
use constant LADBI => "ladbi";
POE::Component::LaDBI->create( Alias => LADBI );
my $r;
for(my $j=1;$j<3;$j++)
{
for(my $i=1;$i<=150;$i++)
{
POE::Component::My::DBI->spawn(SQL => $SQL,EVENT =>
"insert");
print "$j : $i\n";
}
sleep 1;
}
$poe_kernel->run;
exit 0;
BEGIN {
package POE::Component::My::DBI;
use POE::Session;
sub spawn {
my $class = shift;
POE::Session->create(
package_states => [$class => [qw(_start _stop selectall
dberror shutdown display insert check_do_results)]],
heap => [EMAIL PROTECTED]
);
}
sub _start {
# print $_[HEAP]->{EVENT};
$_[KERNEL]->post( ladbi => "connect",
SuccessEvent => $_[HEAP]->{EVENT},
FailureEvent => "db",
Args => ["dbi:Pg:dbname=data", "someuser", "somepass"],
);
}
sub _stop {
my($dbh_id)[EMAIL PROTECTED];
print "stop it\n";
$_[KERNEL]->post( ladbi => "disconnect",
SuccessEvent => "error",
FailureEvent => "dberror",
HandleId => $dbh_id);
}
sub selectall {
print "nofate\n";
my($dbh_id)[EMAIL PROTECTED];
$_[HEAP]->{dbh_id}=$dbh_id;
print $dbh_id;
$_[KERNEL]->post( ladbi => "selectall",
SuccessEvent => "display",
FailtureEvent => "dberror",
HandleID => $dbh_id,
Args => [$_[HEAP]->{SQL}]);
}
sub insert {
my($dbh_id)[EMAIL PROTECTED];
$_[KERNEL]->post( ladbi => "do",
SuccessEvent => "check_do_results",
FailureEvent => "dberror",
HandleId => $dbh_id,
Args => [$_[HEAP]->{SQL}]);
}
sub check_do_results {
$r++;
print "do ok $r\n";
}
sub display {
print @_[HEAP]->{SQL};
my ($dbh_id,$datatype,$data)= @_[ARG0..ARG2];
for my $row(@$data)
{
print join(",",@$row),"\n";
}
}
sub dberror {
print "error";
# $_[KERNEL]->yield("shutdown");
}
}
__________________________________
Thank you very much.
---
Professional hosting for everyone - http://www.host.ru
|
|