summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03cb899)
raw | patch | inline | side by side (parent: 03cb899)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 7 Sep 2010 15:42:04 +0000 (15:42 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 7 Sep 2010 15:42:04 +0000 (15:42 +0000) |
timeout of 30 seconds configurable. This is the time a client waits for
the locked database to become free before giving up. Used only for
SQLite backend.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4521 57a73879-2fb5-44c3-a270-3262357dd7e2
the locked database to become free before giving up. Used only for
SQLite backend.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4521 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/backends/back_sqlite.py | patch | blob | history | |
roundup/configuration.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index d0a8950e6cfb78a51d98411573ad0e46bf747989..fc38e5e02616e1cf36ac9d2a701d19316d67ed66 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
title with the changed subject. Thanks to Arkadiusz Kita and Peter
Funk for requesting the feature and discussing the implementation.
http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10169
+- new rdbms config item sqlite_timeout makes the previously hard-coded
+ timeout of 30 seconds configurable. This is the time a client waits
+ for the locked database to become free before giving up. Used only for
+ SQLite backend.
Fixed:
index c947eb3392d74b1e930cbee525bcc7a0ed3e3dfa..5d6be0195750cd67e05acf7ed1680c2732f8869c 100644 (file)
def sqlite_busy_handler(self, data, table, count):
"""invoked whenever SQLite tries to access a database that is locked"""
+ now = time.time()
if count == 1:
- # use a 30 second timeout (extraordinarily generous)
- # for handling locked database
- self._busy_handler_endtime = time.time() + 30
- elif time.time() > self._busy_handler_endtime:
+ # Timeout for handling locked database (default 30s)
+ self._busy_handler_endtime = now + self.config.RDBMS_SQLITE_TIMEOUT
+ elif now > self._busy_handler_endtime:
# timeout expired - no more retries
return 0
# sleep adaptively as retry count grows,
db = os.path.join(self.config.DATABASE, 'db')
logging.getLogger('hyperdb').info('open database %r'%db)
- # set a 30 second timeout (extraordinarily generous) for handling
- # locked database
+ # set timeout (30 second default is extraordinarily generous)
+ # for handling locked database
if sqlite_version == 1:
conn = sqlite.connect(db=db)
conn.db.sqlite_busy_handler(self.sqlite_busy_handler)
else:
- conn = sqlite.connect(db, timeout=30)
+ conn = sqlite.connect(db, timeout=self.config.RDBMS_SQLITE_TIMEOUT)
conn.row_factory = sqlite.Row
# pysqlite2 / sqlite3 want us to store Unicode in the db but
index dbbac6f11eb6186138925eb17422fcfcbaec1747..60b4190b1f4f357dc695ff015070a876687544dc 100644 (file)
--- a/roundup/configuration.py
+++ b/roundup/configuration.py
(NullableOption, 'read_default_group', 'roundup',
"Name of the group to use in the MySQL defaults file (.my.cnf).\n"
"Only used in MySQL connections."),
+ (IntegerNumberOption, 'sqlite_timeout', '30',
+ "Number of seconds to wait when the SQLite database is locked\n"
+ "Default: use a 30 second timeout (extraordinarily generous)\n"
+ "Only used in SQLite connections."),
(IntegerNumberOption, 'cache_size', '100',
"Size of the node cache (in elements)"),
), "Settings in this section are used"