diff --git a/pscheduler-server/pscheduler-server/api-server/pscheduler-api-server.conf.raw b/pscheduler-server/pscheduler-server/api-server/pscheduler-api-server.conf.raw index df9eec609..3b7042e26 100644 --- a/pscheduler-server/pscheduler-server/api-server/pscheduler-api-server.conf.raw +++ b/pscheduler-server/pscheduler-server/api-server/pscheduler-api-server.conf.raw @@ -10,8 +10,9 @@ WSGIDaemonProcess __USER_NAME__ \ \ processes=10 \ maximum-requests=1000000 \ - graceful-timeout=300 - + graceful-timeout=300 \ + restart-interval=1800 \ + inactivity-timeout=600 WSGIScriptAlias __API_ROOT__ __API_DIR__/__NAME__.wsgi diff --git a/pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/dbcursor.py b/pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/dbcursor.py index 7819061f5..72bcd1e13 100644 --- a/pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/dbcursor.py +++ b/pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/dbcursor.py @@ -65,7 +65,7 @@ def cursor(self): # Make sure we have a cursor. - if self.ccursor is None or self.ccursor.closed(): + if self.ccursor is None or self.ccursor.closed: self.ccursor = self.db.cursor() return self.ccursor @@ -74,7 +74,12 @@ def cursor(self): def dbcursor(): """Get this thread's database cursor""" - return getattr(module.threadlocal, "cursor", DBCursor()).cursor() + try: + cursor = getattr(module.threadlocal, 'cursor') + except AttributeError: + cursor = DBCursor() + setattr(module.threadlocal, 'cursor', cursor) + return cursor.cursor() def dbcursor_query(query,