Fix concurrency login
- Do not loose old session before new one is created - Restore raising exception if login is locked (lost in changeset bf55d0d38d01) issue5742 review32351003
This commit is contained in:
1 parent
2dbfdd8d9a
commit
ecf9704545
2 files changed
+8
-9
No files matched your search
@@ -1039,7 +1039,7 @@ def process_exception(exception, *args, **kwargs):
|
||||
elif exception.faultCode.startswith('403'):
|
||||
from tryton.gui.main import Main
|
||||
if not PLOCK.acquire(False):
|
||||
return
|
||||
return False
|
||||
language = CONFIG['client.lang']
|
||||
func = lambda parameters: rpc.login(
|
||||
rpc._HOST, rpc._PORT, rpc._DATABASE, rpc._USERNAME, parameters,
|
||||
|
||||
+7
-8
@@ -64,24 +64,23 @@ def server_version(host, port):
|
||||
def login(host, port, database, username, parameters, language=None):
|
||||
global CONNECTION, _USER, _USERNAME, _HOST, _PORT, _DATABASE
|
||||
global _VIEW_CACHE, _TOOLBAR_CACHE, _KEYWORD_CACHE
|
||||
_VIEW_CACHE = {}
|
||||
_TOOLBAR_CACHE = {}
|
||||
_KEYWORD_CACHE = {}
|
||||
if CONNECTION is not None:
|
||||
CONNECTION.close()
|
||||
CONNECTION = ServerPool(host, port, database)
|
||||
connection = ServerProxy(host, port, database)
|
||||
logging.getLogger(__name__).info('common.db.login(%s, %s, %s)'
|
||||
% (username, 'x' * 10, language))
|
||||
with CONNECTION() as conn:
|
||||
result = conn.common.db.login(username, parameters, language)
|
||||
result = connection.common.db.login(username, parameters, language)
|
||||
logging.getLogger(__name__).debug(repr(result))
|
||||
_USER = result[0]
|
||||
_USERNAME = username
|
||||
session = ':'.join(map(str, [username] + result))
|
||||
if CONNECTION is not None:
|
||||
CONNECTION.close()
|
||||
CONNECTION = ServerPool(host, port, database, session=session)
|
||||
_HOST = host
|
||||
_PORT = port
|
||||
_DATABASE = database
|
||||
_VIEW_CACHE = {}
|
||||
_TOOLBAR_CACHE = {}
|
||||
_KEYWORD_CACHE = {}
|
||||
IPCServer(host, port, database).run()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user