[FIX] res.users: don't delay login() if user row is currently locked
authorOlivier Dony <odo@openerp.com>
Mon, 13 Feb 2012 18:32:07 +0000 (19:32 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 13 Feb 2012 18:32:07 +0000 (19:32 +0100)
commitf87324e93e11c793b31c5e0f4d65bf7ed4751082
tree1b0bc2fce57bf8d3bd35819b33864511ec857e04
parente7ca80cdeb11ebb178ae69ef42276985ddcfbeef
[FIX] res.users: don't delay login() if user row is currently locked

Any running transaction that has created or altered
a record that contains a FK to the user is automatically
holding an SharedRowLock that prevents login() from
updating the last login date. As we cannot delay the
login() until all such transactions are finished,
it's simpler to try to get the lock and if that
fails, we skip the login date update for once,
no big deal.
A typical candidate for this situation is the
Admin user, locked out by long running cron
jobs that touch rows as Admin, hence holding
a ShareRowLock to res.users ID 1 because of the
many create_uid/write_uid foreign keys.

lp bug: https://launchpad.net/bugs/713216 fixed

bzr revid: odo@openerp.com-20120213183207-45ptopqm0szritgx
openerp/addons/base/res/res_users.py