From: Michael S. <Mic...@lr...> - 2009-08-18 10:45:38
|
Hi, if you are working on a new version, you could include this little change to tune subroutine update_dbnow: my $old_time = 0; # used for faster dbnow my $new_time = 0; --- update_dbnow.old 2009-08-18 12:25:46.618399188 +0200 +++ update_dbnow.new 2009-08-18 12:40:28.486024736 +0200 @@ -1,19 +1,27 @@ sub update_dbnow($) { my $self = shift; # no dbnow needed for SQLite return if $self->SQLite(); + # if called in the same second, no update of dbnow needed + $new_time = time; + if ($new_time == $old_time) { + return; + } else { + $old_time = $new_time; + } + my $result; my $sth = $self->prepare_cached('SELECT now()'); if (!defined $sth or !$sth->execute()) { $self->db_unavailable(); $self->mylog('dbaccess', 0, "error: couldn't get now() from DB: $DBI::errstr"); return if defined $self->{sqlgrey}{dbnow}; # defined: we don't update the value $self->{sqlgrey}{dbnow} = '0'; } else { $self->db_available(); $result = $sth->fetchall_arrayref(); $self->{sqlgrey}{dbnow} = $self->quote($result->[0][0]); } } Regards, Michael Storz |