Mercurial > p > roundup > code
changeset 3717:5770f1802cd0
better conflict retry in postgresql backend [SF#1552809]
fix time log example [SF#1554630]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 03 Oct 2006 23:28:51 +0000 |
| parents | 4cbbf9210edd |
| children | 0d561b24ceff |
| files | CHANGES.txt doc/customizing.txt doc/index.txt roundup/backends/back_postgresql.py |
| diffstat | 4 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue Oct 03 23:18:25 2006 +0000 +++ b/CHANGES.txt Tue Oct 03 23:28:51 2006 +0000 @@ -55,6 +55,8 @@ in classic template (sf patch 1424576) - "as" is a keyword in Python 2.6 - "from __future__" statments need to be first line of file in Python 2.6 +- better conflict retry in postgresql backend (sf bug 1552809) +- fix time log example (sf bug 1554630) 2006-04-27 1.1.2
--- a/doc/customizing.txt Tue Oct 03 23:18:25 2006 +0000 +++ b/doc/customizing.txt Tue Oct 03 23:28:51 2006 +0000 @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.207 $ +:Version: $Revision: 1.208 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -3373,11 +3373,13 @@ to the ``extensions`` directory in our tracker. The contents of this file is as follows:: + from roundup import date + def totalTimeSpent(times): ''' Call me with a list of timelog items (which have an Interval "period" property) ''' - total = Interval('0d') + total = date.Interval('0d') for time in times: total += time.period._value return total
--- a/doc/index.txt Tue Oct 03 23:18:25 2006 +0000 +++ b/doc/index.txt Tue Oct 03 23:28:51 2006 +0000 @@ -63,6 +63,7 @@ Thanks also to the many people on the mailing list, in the sourceforge project and those who just report bugs: Thomas Arendsen Hein, +Nerijus Baliunas, Anthony Baxter, Marlon van den Berg, Bo Berglund,
--- a/roundup/backends/back_postgresql.py Tue Oct 03 23:18:25 2006 +0000 +++ b/roundup/backends/back_postgresql.py Tue Oct 03 23:28:51 2006 +0000 @@ -1,4 +1,4 @@ -#$Id: back_postgresql.py,v 1.35 2006-10-03 23:15:09 richard Exp $ +#$Id: back_postgresql.py,v 1.36 2006-10-03 23:28:51 richard Exp $ # # Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <andrey@micro.lt> # @@ -70,6 +70,8 @@ def pg_command(cursor, command): '''Execute the postgresql command, which may be blocked by some other user connecting to the database, and return a true value if it succeeds. + + If there is a concurrent update, retry the command. ''' try: cursor.execute(command) @@ -78,10 +80,18 @@ if response.find('FATAL') != -1: raise RuntimeError, response elif response.find('ERROR') != -1: - if response.find('is being accessed by other users') == -1: - raise RuntimeError, response - time.sleep(1) - return 0 + msgs = [ + 'is being accessed by other users', + 'could not serialize access due to concurrent update', + ] + can_retry = 0 + for msg in msgs: + if response.find(msg) == -1: + can_retry = 1 + if can_retry: + time.sleep(1) + return 0 + raise RuntimeError, response return 1 def db_exists(config):
