From 281b5d6baba694aa7b99be87a7be46a59ed0bd6c Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Thu, 5 Jan 2012 15:19:44 +0000 Subject: [PATCH] various small speed up changes --- perl/DXChannel.pm | 2 +- perl/DXUser.pm | 4 +++- perl/Msg.pm | 2 +- perl/Version.pm | 4 ++-- perl/cluster.pl | 8 +++++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 64a9a1ae..517372fa 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -706,7 +706,7 @@ sub broadcast_list sub process { - foreach my $dxchan (get_all()) { + foreach my $dxchan (values %channels) { while (my $data = shift @{$dxchan->{inqueue}}) { my ($sort, $call, $line) = $dxchan->decode_input($data); diff --git a/perl/DXUser.pm b/perl/DXUser.pm index b868eaa9..c273970b 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -181,7 +181,7 @@ sub init if ($v4) { my $new = ! -e $ufn; $dbh = DBI->connect("dbi:SQLite:dbname=$ufn","","") or die "Cannot open $ufn ($!)\n"; - if ($new && $dbh) { + if ($new) { # create the table my $table = q{create table user( call text not null unique, @@ -193,6 +193,8 @@ data text not null # Add indexes $dbh->do(q(create index x1 on user(lastseen))) or die $dbh->errstr; } + $dbh->do(q{PRAGMA cache_size = 8000}); + $dbh->do(q{PRAGMA synchronous = OFF}); } diff --git a/perl/Msg.pm b/perl/Msg.pm index d44d4f4f..fc1179c5 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -316,7 +316,7 @@ sub new_server { my ($pkg, $my_host, $my_port, $login_proc) = @_; my $self = $pkg->new($login_proc); - $self->{sock} = tcp_server $my_host, $my_port, sub { $self->new_client(@_); }, sub { return 256; }; + $self->{sock} = tcp_server $my_host, $my_port, sub { $self->new_client(@_); }; die "Could not create socket: $! \n" unless $self->{sock}; return $self; } diff --git a/perl/Version.pm b/perl/Version.pm index aa6e1a07..8142a148 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,7 +11,7 @@ use vars qw($version $subversion $build $gitversion); $version = '1.56'; $subversion = '0'; -$build = '15'; -$gitversion = '955a8e0'; +$build = '16'; +$gitversion = 'fb8e4bc'; 1; diff --git a/perl/cluster.pl b/perl/cluster.pl index 43828974..745ad1dd 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -123,7 +123,7 @@ use vars qw(@inqueue $systime $starttime $lockfn @outstanding_connects $zombies $root @listeners $lang $myalias @debug $userfn $clusteraddr $clusterport $mycall $decease $is_win $routeroot $me $reqreg $bumpexisting $allowdxby $dbh $dsn $dbuser $dbpass $do_xml $systime_days $systime_daystart - $can_encode $maxconnect_user $maxconnect_node + $can_encode $maxconnect_user $maxconnect_node $idle_interval ); @inqueue = (); # the main input queue, an array of hashes @@ -138,6 +138,7 @@ $maxconnect_user = 3; # the maximum no of concurrent connections a user can ha $maxconnect_node = 0; # Ditto but for nodes. In either case if a new incoming connection # takes the no of references in the routing table above these numbers # then the connection is refused. This only affects INCOMING connections. +$idle_interval = 0.100; # the wait between invocations of the main idle loop processing. # send a message to call on conn and disconnect sub already_conn @@ -300,6 +301,8 @@ sub cease } LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitversion) ended"); + dbg("bye bye everyone - bye bye"); + dbgclose(); Logclose(); @@ -582,11 +585,10 @@ $script->run($main::me) if $script; #open(DB::OUT, "|tee /tmp/aa"); -my $per_sec = AnyEvent->timer(after => 0, interval => 0.010, cb => sub{idle_loop()}); +my $per_sec = AnyEvent->timer(after => 0, interval => $idle_interval, cb => sub{idle_loop()}); # main loop $decease->recv; -#AnyEvent->loop; idle_loop() for (1..25); cease(0); -- 2.43.0