Got help earlier with keeping my database connections alive between
requests:
https://groups.google.com/forum/#!topic/web2py/QraWtFvlqf8
I put my databases in a module like this:
class Databases():
_td_db = None
@staticmethod
def getTDDB():
dbCreated = False
if Databases._td_db is None:
Databases._td_db = DAL('mysql://' + TD_DB_MYSQL_USER + ':' +
TD_DB_MYSQL_PASS + '@' + TD_DB_URL + ':' + TD_DB_PORT + '/TD')
dbCreated = True
return Databases._td_db, dbCreated
After doing this I get very weird issues:
- Writing a value sometimes fails with lock timeout
- Writing a value and then reading a value sometimes doesn't give the
written value back but instead what was written before (cache issue?)
I find nothing in web2py documentation about inbuilt caching, any idea what
may cause these issues?
Going back to always recreating the DAL object seems to fix the issues.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/203c6fd1-e25b-4f5c-91a4-bbf30d5dda6e%40googlegroups.com.