I noticed a pretty nasty glitch while scaling my production server today :
The implementation of "close_connection()" in dal.py doesn't work well with
multiple dynos in a cloud hosting solution.
Here's the code I have, runnint web2py 2.9.5 :
def close_connection(self):
if self.db is not None:
self.db.executesql(
"DELETE FROM web2py_filesystem WHERE path='%s'" %
self.filename)
query = "INSERT INTO web2py_filesystem(path,content) VALUES
('%s','%s')"\
% (self.filename, self.data.replace("'","''"))
self.db.executesql(query)
self.db.commit()
self.db = None
I'm getting tons of tickets like this one :
<class 'psycopg2.IntegrityError'> duplicate key value violates unique
constraint "web2py_filesystem_pkey" DETAIL: Key
(path)=(applications/*****/databases/f1bf5dc7f74c28ea704f3313ce9b1535_******.table)
already exists.
I think both dynos are trying to do the INSERT operation at the same time,
which shouldn't happen.
How can I fix this ?
--
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].
For more options, visit https://groups.google.com/d/optout.