##// END OF EJS Templates
threading: Use the curl session factory.
Martin Bornhold -
r244:a99bca28 default
parent child Browse files
Show More
@@ -93,11 +93,14 b' def connect_http(server_and_port):'
93 from rhodecode.lib.vcs import connection, client_http
93 from rhodecode.lib.vcs import connection, client_http
94 from rhodecode.lib.middleware.utils import scm_app
94 from rhodecode.lib.middleware.utils import scm_app
95
95
96 session = _create_http_rpc_session()
96 session_factory = client_http.ThreadlocalSessionFactory()
97
97
98 connection.Git = client_http.RepoMaker(server_and_port, '/git', session)
98 connection.Git = client_http.RepoMaker(
99 connection.Hg = client_http.RepoMaker(server_and_port, '/hg', session)
99 server_and_port, '/git', session_factory)
100 connection.Svn = client_http.RepoMaker(server_and_port, '/svn', session)
100 connection.Hg = client_http.RepoMaker(
101 server_and_port, '/hg', session_factory)
102 connection.Svn = client_http.RepoMaker(
103 server_and_port, '/svn', session_factory)
101
104
102 scm_app.HG_REMOTE_WSGI = client_http.VcsHttpProxy(
105 scm_app.HG_REMOTE_WSGI = client_http.VcsHttpProxy(
103 server_and_port, '/proxy/hg')
106 server_and_port, '/proxy/hg')
@@ -55,15 +55,16 b' EXCEPTIONS_MAP = {'
55
55
56 class RepoMaker(object):
56 class RepoMaker(object):
57
57
58 def __init__(self, server_and_port, backend_endpoint, session):
58 def __init__(self, server_and_port, backend_endpoint, session_factory):
59 self.url = urlparse.urljoin(
59 self.url = urlparse.urljoin(
60 'http://%s' % server_and_port, backend_endpoint)
60 'http://%s' % server_and_port, backend_endpoint)
61 self._session = session
61 self._session_factory = session_factory
62
62
63 def __call__(self, path, config, with_wire=None):
63 def __call__(self, path, config, with_wire=None):
64 log.debug('RepoMaker call on %s', path)
64 log.debug('RepoMaker call on %s', path)
65 return RemoteRepo(
65 return RemoteRepo(
66 path, config, self.url, self._session, with_wire=with_wire)
66 path, config, self.url, self._session_factory(),
67 with_wire=with_wire)
67
68
68 def __getattr__(self, name):
69 def __getattr__(self, name):
69 def f(*args, **kwargs):
70 def f(*args, **kwargs):
@@ -77,7 +78,8 b' class RepoMaker(object):'
77 'method': name,
78 'method': name,
78 'params': {'args': args, 'kwargs': kwargs}
79 'params': {'args': args, 'kwargs': kwargs}
79 }
80 }
80 return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session)
81 return _remote_call(
82 self.url, payload, EXCEPTIONS_MAP, self._session_factory())
81
83
82
84
83 class RemoteRepo(object):
85 class RemoteRepo(object):
General Comments 0
You need to be logged in to leave comments. Login now