From: Nathan Wagner Date: Sat, 27 Oct 2012 22:33:27 +0000 (+0000) Subject: Let database figure out close time for connection. X-Git-Url: https://pd.if.org/git/?p=newsd;a=commitdiff_plain;h=5287daf6ddee09818fc8be2c1c3422ab769de020 Let database figure out close time for connection. --- diff --git a/Net-Server-NNTP/lib/Net/Server/NNTP/Postgres.pm b/Net-Server-NNTP/lib/Net/Server/NNTP/Postgres.pm index 13e1850..5a7d541 100644 --- a/Net-Server-NNTP/lib/Net/Server/NNTP/Postgres.pm +++ b/Net-Server-NNTP/lib/Net/Server/NNTP/Postgres.pm @@ -417,12 +417,12 @@ sub log_stats { $s->commit; $s->rollback; - my $stats = $s->prepare(q{insert into sessions (peer, addr, port, connected, closed, received, refused, rejected, postponed) values (?,?,?,timestamp with time zone 'epoch' + ? * INTERVAL '1 second',timestamp with time zone 'epoch' + ? * INTERVAL '1 second',?,?,?,?)}); + my $stats = $s->prepare(q{insert into sessions (peer, addr, port, connected, closed, received, refused, rejected, postponed) values (?,?,?,timestamp with time zone 'epoch' + ? * INTERVAL '1 second',current_timestamp,?,?,?,?)}); $stats->execute($s->{nntp}{peername}, $s->{server}->{peeraddr}, $s->{server}->{peerport}, - $s->{nntp}{connecttime}, time, + $s->{nntp}{connecttime}, $rec, $ref, $rej, $postp); $s->commit; }