Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix logging and associated tests.

  • Loading branch information
cyrusdaboo committed Feb 11, 2014
1 parent d80d6c9 commit da1e4881e36e3753f5f96585f41a15f479759317
Showing with 13 additions and 13 deletions.
  1. +10 −10 txdav/common/datastore/sql.py
  2. +3 −3 txdav/common/datastore/test/test_sql.py
@@ -443,11 +443,11 @@ def _installLogTimer(self):
def _logTransactionWait():
if self.txn is not None:
log.error(
"Transaction wait: {self.txn}, "
"Statements: {self.txn.statementCount!d}, "
"IUDs: {self.txn.iudCount!d}, "
"Statement: {self.txn.currentStatement}",
self=self
"Transaction wait: {me.txn}, "
"Statements: {me.txn.statementCount!d}, "
"IUDs: {me.txn.iudCount!d}, "
"Statement: {me.txn.currentStatement}",
me=self
)
self.delayedLog = self.callLater(
self.logTimerSeconds, _logTransactionWait
@@ -463,11 +463,11 @@ def _installTimeout(self):
def _forceAbort():
if self.txn is not None:
log.error(
"Transaction abort too long: {self.txn}, "
"Statements: {self.txn.statementCount!d}, "
"IUDs: {self.txn.iudCount!d}, "
"Statement: {self.txn.currentStatement}",
self=self
"Transaction abort too long: {me.txn}, "
"Statements: {me.txn.statementCount!d}, "
"IUDs: {me.txn.iudCount!d}, "
"Statement: {me.txn.currentStatement}",
me=self
)
self.delayedTimeout = None
if self.delayedLog:
@@ -100,7 +100,7 @@ def test_logWaits(self):
self.patch(self._sqlStore, "logTransactionWaits", 1)

ctr = [0]
def counter(_ignore):
def counter(*args, **kwargs):
ctr[0] += 1
self.patch(log, "error", counter)

@@ -123,7 +123,7 @@ def test_txnTimeout(self):
self.patch(self._sqlStore, "timeoutTransactions", 1)

ctr = [0]
def counter(_ignore):
def counter(*args, **kwargs):
ctr[0] += 1
self.patch(log, "error", counter)

@@ -149,7 +149,7 @@ def test_logWaitsAndTxnTimeout(self):
self.patch(self._sqlStore, "timeoutTransactions", 2)

ctr = [0, 0]
def counter(logStr):
def counter(logStr, *args, **kwargs):
if "wait" in logStr:
ctr[0] += 1
elif "abort" in logStr:

0 comments on commit da1e488

Please sign in to comment.
You can’t perform that action at this time.