threading: Use the curl session factory.
This commit is contained in:
parent
4a1c60fba2
commit
6b84fcdb1d
2 changed files with 13 additions and 8 deletions
|
|
@ -93,11 +93,14 @@ def connect_http(server_and_port):
|
|||
from rhodecode.lib.vcs import connection, client_http
|
||||
from rhodecode.lib.middleware.utils import scm_app
|
||||
|
||||
session = _create_http_rpc_session()
|
||||
session_factory = client_http.ThreadlocalSessionFactory()
|
||||
|
||||
connection.Git = client_http.RepoMaker(server_and_port, '/git', session)
|
||||
connection.Hg = client_http.RepoMaker(server_and_port, '/hg', session)
|
||||
connection.Svn = client_http.RepoMaker(server_and_port, '/svn', session)
|
||||
connection.Git = client_http.RepoMaker(
|
||||
server_and_port, '/git', session_factory)
|
||||
connection.Hg = client_http.RepoMaker(
|
||||
server_and_port, '/hg', session_factory)
|
||||
connection.Svn = client_http.RepoMaker(
|
||||
server_and_port, '/svn', session_factory)
|
||||
|
||||
scm_app.HG_REMOTE_WSGI = client_http.VcsHttpProxy(
|
||||
server_and_port, '/proxy/hg')
|
||||
|
|
|
|||
|
|
@ -55,15 +55,16 @@ EXCEPTIONS_MAP = {
|
|||
|
||||
class RepoMaker(object):
|
||||
|
||||
def __init__(self, server_and_port, backend_endpoint, session):
|
||||
def __init__(self, server_and_port, backend_endpoint, session_factory):
|
||||
self.url = urlparse.urljoin(
|
||||
'http://%s' % server_and_port, backend_endpoint)
|
||||
self._session = session
|
||||
self._session_factory = session_factory
|
||||
|
||||
def __call__(self, path, config, with_wire=None):
|
||||
log.debug('RepoMaker call on %s', path)
|
||||
return RemoteRepo(
|
||||
path, config, self.url, self._session, with_wire=with_wire)
|
||||
path, config, self.url, self._session_factory(),
|
||||
with_wire=with_wire)
|
||||
|
||||
def __getattr__(self, name):
|
||||
def f(*args, **kwargs):
|
||||
|
|
@ -77,7 +78,8 @@ class RepoMaker(object):
|
|||
'method': name,
|
||||
'params': {'args': args, 'kwargs': kwargs}
|
||||
}
|
||||
return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session)
|
||||
return _remote_call(
|
||||
self.url, payload, EXCEPTIONS_MAP, self._session_factory())
|
||||
|
||||
|
||||
class RemoteRepo(object):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue