summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-06-15 23:00:22 +0200
committerYorhel <git@yorhel.nl>2009-06-15 23:05:37 +0200
commit0aed5e728eaa7c71af9a26426d4492cac7dbbabc (patch)
treefb4fb55ea2de9bd21c80ec3b2c4da1df28f18053
parent40f4467fe4e150fca97203edf09393833fb6bdf1 (diff)
Fixed calculation of SQL time and number of queries in debug log
SQL time always missed one query, and number of queries was off when manually calling dbCommit from outside YAWF.
-rw-r--r--lib/YAWF.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/YAWF.pm b/lib/YAWF.pm
index 1cc9e02..b9fe7f8 100644
--- a/lib/YAWF.pm
+++ b/lib/YAWF.pm
@@ -203,10 +203,11 @@ sub handle_request {
# > 12ms (SQL: 8ms, 2 qs) for http://beta.vndb.org/v10
if($self->debug) {
- # SQL stats (don't count the ping and commit as queries)
- my($sqlt, $sqlc) = (0, -2);
+ # SQL stats (don't count the ping and commit as queries, but do count their time)
+ my($sqlt, $sqlc) = (0);
if($self->{_YAWF}{db_login}) {
- ++$sqlc and $sqlt += $_->[1]*1000
+ $sqlc = grep $_->[0] ne 'ping/rollback' && $_->[0] ne 'commit', @{$self->{_YAWF}{DB}{queries}};
+ $sqlt += $_->[1]*1000
for (@{$self->{_YAWF}{DB}{queries}});
}