diff options
author | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-08-18 18:12:09 +0000 |
---|---|---|
committer | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-08-18 18:12:09 +0000 |
commit | c28e1bf6b01b8e1d082d8df8861c65db3be42b3e (patch) | |
tree | 8d35d1fe7317e7d4fec6a830cc4490c7c59c5af0 /lib | |
parent | 6e50d7f066d3dc64e65a3503431dff690df743fb (diff) |
Found a definite and proper solution to fix the command synchronisation problems, fixed display of wrong ID for screenshot diff, and increased screenshot JPEG quality to 90
git-svn-id: svn://vndb.org/vndb@95 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Multi/IRC.pm | 2 | ||||
-rw-r--r-- | lib/Multi/Image.pm | 6 | ||||
-rw-r--r-- | lib/Multi/RG.pm | 1 | ||||
-rw-r--r-- | lib/VNDB.pm | 5 | ||||
-rw-r--r-- | lib/VNDB/Util/Tools.pm | 17 |
5 files changed, 19 insertions, 12 deletions
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm index 030c9ee2..4a60f324 100644 --- a/lib/Multi/IRC.pm +++ b/lib/Multi/IRC.pm @@ -257,7 +257,7 @@ sub vndbid { # dest, msg, force sub ircnotify { # command, VNDBID - $_[KERNEL]->delay(vndbid => 1 => $_ => $_[ARG1] => 1) for (@{$_[HEAP]{notify}}); + $_[KERNEL]->yield(vndbid => $_ => $_[ARG1] => 1) for (@{$_[HEAP]{notify}}); $_[KERNEL]->post(core => finish => $_[ARG0]); } diff --git a/lib/Multi/Image.pm b/lib/Multi/Image.pm index 4e4e6a48..fb712afd 100644 --- a/lib/Multi/Image.pm +++ b/lib/Multi/Image.pm @@ -95,8 +95,6 @@ sub cv_process { # id sub cv_update { # id if($Multi::SQL->do('UPDATE vn_rev SET image = ? WHERE image = ?', undef, $_[ARG0], -1*$_[ARG0]) > 0) { $_[KERNEL]->yield(cv_finish => $_[ARG0]); - } elsif(!$_[ARG1]) { - $_[KERNEL]->delay(cv_update => 3 => $_[ARG0], 1); } else { $_[KERNEL]->call(core => log => 1, 'Image %d not present in the database!', $_[ARG0]); $_[KERNEL]->yield(cv_finish => $_[ARG0]); @@ -160,7 +158,7 @@ sub scr_process { # id my $im = Image::Magick->new; $im->Read($sf); $im->Set(magick => 'JPEG'); - $im->Set(quality => 80); + $im->Set(quality => 90); $im->Write($sf); # create thumbnail @@ -196,8 +194,6 @@ sub scr_process { # id sub scr_update { # id, width, height if($Multi::SQL->do('UPDATE screenshots SET status = 1, width = ?, height = ? WHERE id = ?', undef, $_[ARG1], $_[ARG2], $_[ARG0]) > 0) { $_[KERNEL]->yield(scr_finish => $_[ARG0]); - } elsif(!$_[ARG3]) { - $_[KERNEL]->delay(scr_update => 3 => @_[ARG0..$#_], 1); } else { $_[KERNEL]->call(core => log => 1, 'Screenshot %d not present in the database!', $_[ARG0]); $_[KERNEL]->yield(scr_finish => $_[ARG0]); diff --git a/lib/Multi/RG.pm b/lib/Multi/RG.pm index 141aca34..8c45014a 100644 --- a/lib/Multi/RG.pm +++ b/lib/Multi/RG.pm @@ -25,7 +25,6 @@ sub spawn { font => 'Arial', fsize => [ 9, 7, 10 ], # nodes, edges, node_title imgdir => '/www/vndb/static/rg', - datdir => '/www/vndb/data/rg', moy => [qw| Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec |], dot => '/usr/bin/dot', @_, diff --git a/lib/VNDB.pm b/lib/VNDB.pm index 441175cb..810644a2 100644 --- a/lib/VNDB.pm +++ b/lib/VNDB.pm @@ -187,6 +187,7 @@ sub new { %args, _DB => VNDB::Util::DB->new(@VNDB::DBLOGIN), _TPL => VNDB::Util::Template->new(%{$args{tplopts}}), + cmds => [], }, $type; return $me; @@ -206,6 +207,10 @@ sub get_page { my $res = $self->ResSetModPerl($r); $self->DBCommit(); + # commands have to be executed _after_ the call to DBCommit, + # otherwise Multi can't see the new additions + $self->RunCmd(); + return($self, $res); } diff --git a/lib/VNDB/Util/Tools.pm b/lib/VNDB/Util/Tools.pm index caa66ef4..9579e2c9 100644 --- a/lib/VNDB/Util/Tools.pm +++ b/lib/VNDB/Util/Tools.pm @@ -151,12 +151,19 @@ sub AddDefaultStuff { } +# commands aren't actually sent until the function is called without cmd parameter sub RunCmd { # cmd - my $s = tie my %s, 'Tie::ShareLite', @VNDB::SHMOPTS; - $s->lock(LOCK_EX); - my @q = ( ($s{queue} ? @{$s{queue}} : ()), $_[1] ); - $s{queue} = \@q; - $s->unlock(); + my($self, $c) = @_; + if($c) { + push @{$self->{cmds}}, $c; + } else { + my $s = tie my %s, 'Tie::ShareLite', @VNDB::SHMOPTS; + $s->lock(LOCK_EX); + my @q = ( ($s{queue} ? @{$s{queue}} : ()), @{$self->{cmds}} ); + $s{queue} = \@q; + $s->unlock(); + $self->{cmds} = []; + } } |