summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMarko Kreen2007-04-06 08:58:18 +0000
committerMarko Kreen2007-04-06 08:58:18 +0000
commitb15b1be88ceda2b457f9b7d0258ae94e6128c090 (patch)
tree6a04277d8f40967cc0abff1d77a40c9e63a6dc63 /python
parent2c901a4b34b4fd7fc591e9fef9ce5820370b026d (diff)
various tweaks to get regtest pass more predictibly
Diffstat (limited to 'python')
-rw-r--r--python/pgq/ticker.py3
-rw-r--r--python/skytools/scripting.py9
2 files changed, 9 insertions, 3 deletions
diff --git a/python/pgq/ticker.py b/python/pgq/ticker.py
index c218eaf1..8f726c78 100644
--- a/python/pgq/ticker.py
+++ b/python/pgq/ticker.py
@@ -143,10 +143,11 @@ class SmartTicker(skytools.DBScript):
def work(self):
db = self.get_database("db", autocommit = 1)
cx = db.cursor()
+ queue_refresh = self.cf.getint('queue_refresh_period', 30)
cur_time = time.time()
- if cur_time >= self.refresh_time + 30:
+ if cur_time >= self.refresh_time + queue_refresh:
self.refresh_queues(cx)
if not self.seq_query:
diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py
index cf976801..456fff69 100644
--- a/python/skytools/scripting.py
+++ b/python/skytools/scripting.py
@@ -396,13 +396,14 @@ class DBScript(object):
self.stat_dict = {}
def get_database(self, dbname, autocommit = 0, isolation_level = -1,
- cache = None, max_age = DEF_CONN_AGE):
+ cache = None):
"""Load cached database connection.
User must not store it permanently somewhere,
as all connections will be invalidated on reset.
"""
+ max_age = self.cf.getint('connection_lifetime', DEF_CONN_AGE)
if not cache:
cache = dbname
if cache in self.db_cache:
@@ -506,7 +507,11 @@ class DBScript(object):
return 1
def work(self):
- "Here should user's processing happen."
+ """Here should user's processing happen.
+
+ Return value is taken as boolean - if true, the next loop
+ starts immidiately. If false, DBScript sleeps for a loop_delay.
+ """
raise Exception("Nothing implemented?")
def startup(self):