##// END OF EJS Templates
vcs: Fix vcsserver startup with http backend.
Martin Bornhold -
r964:eac204f1 default
parent child Browse files
Show More
@@ -46,7 +46,7 b' from Pyro4.errors import CommunicationEr'
46 46 from rhodecode.lib.vcs.conf import settings
47 47 from rhodecode.lib.vcs.backends import get_vcs_instance, get_backend
48 48 from rhodecode.lib.vcs.exceptions import (
49 VCSError, RepositoryError, CommitError)
49 VCSError, RepositoryError, CommitError, VCSCommunicationError)
50 50
51 51 log = logging.getLogger(__name__)
52 52
@@ -180,7 +180,7 b' def _start_http_vcs_server(server_and_po'
180 180
181 181 host, port = server_and_port.rsplit(":", 1)
182 182 args = [
183 'pserve', 'vcsserver/development_pyramid.ini',
183 'pserve', 'rhodecode/tests/vcsserver_http.ini',
184 184 'http_port=%s' % (port, ), 'http_host=%s' % (host, )]
185 185 proc = subprocess.Popen(args)
186 186
@@ -192,14 +192,18 b' def _start_http_vcs_server(server_and_po'
192 192 _wait_until_vcs_server_is_reachable(server)
193 193
194 194
195 def _wait_until_vcs_server_is_reachable(server):
196 while xrange(80): # max 40s of sleep
195 def _wait_until_vcs_server_is_reachable(server, timeout=40):
196 begin = time.time()
197 while (time.time() - begin) < timeout:
197 198 try:
198 199 server.ping()
199 break
200 except (CommunicationError, pycurl.error):
201 pass
200 return
201 except (VCSCommunicationError, CommunicationError, pycurl.error):
202 log.debug('VCSServer not started yet, retry to connect.')
202 203 time.sleep(0.5)
204 raise Exception(
205 'Starting the VCSServer failed or took more than {} '
206 'seconds.'.format(timeout))
203 207
204 208
205 209 def _try_to_shutdown_running_server(server_and_port, protocol):
@@ -24,8 +24,7 b' Custom vcs exceptions module.'
24 24
25 25 import functools
26 26 import urllib2
27 import pycurl
28 from Pyro4.errors import CommunicationError
27
29 28
30 29 class VCSCommunicationError(Exception):
31 30 pass
General Comments 0
You need to be logged in to leave comments. Login now