##// 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 from rhodecode.lib.vcs.conf import settings
46 from rhodecode.lib.vcs.conf import settings
47 from rhodecode.lib.vcs.backends import get_vcs_instance, get_backend
47 from rhodecode.lib.vcs.backends import get_vcs_instance, get_backend
48 from rhodecode.lib.vcs.exceptions import (
48 from rhodecode.lib.vcs.exceptions import (
49 VCSError, RepositoryError, CommitError)
49 VCSError, RepositoryError, CommitError, VCSCommunicationError)
50
50
51 log = logging.getLogger(__name__)
51 log = logging.getLogger(__name__)
52
52
@@ -180,7 +180,7 b' def _start_http_vcs_server(server_and_po'
180
180
181 host, port = server_and_port.rsplit(":", 1)
181 host, port = server_and_port.rsplit(":", 1)
182 args = [
182 args = [
183 'pserve', 'vcsserver/development_pyramid.ini',
183 'pserve', 'rhodecode/tests/vcsserver_http.ini',
184 'http_port=%s' % (port, ), 'http_host=%s' % (host, )]
184 'http_port=%s' % (port, ), 'http_host=%s' % (host, )]
185 proc = subprocess.Popen(args)
185 proc = subprocess.Popen(args)
186
186
@@ -192,14 +192,18 b' def _start_http_vcs_server(server_and_po'
192 _wait_until_vcs_server_is_reachable(server)
192 _wait_until_vcs_server_is_reachable(server)
193
193
194
194
195 def _wait_until_vcs_server_is_reachable(server):
195 def _wait_until_vcs_server_is_reachable(server, timeout=40):
196 while xrange(80): # max 40s of sleep
196 begin = time.time()
197 while (time.time() - begin) < timeout:
197 try:
198 try:
198 server.ping()
199 server.ping()
199 break
200 return
200 except (CommunicationError, pycurl.error):
201 except (VCSCommunicationError, CommunicationError, pycurl.error):
201 pass
202 log.debug('VCSServer not started yet, retry to connect.')
202 time.sleep(0.5)
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 def _try_to_shutdown_running_server(server_and_port, protocol):
209 def _try_to_shutdown_running_server(server_and_port, protocol):
@@ -24,8 +24,7 b' Custom vcs exceptions module.'
24
24
25 import functools
25 import functools
26 import urllib2
26 import urllib2
27 import pycurl
27
28 from Pyro4.errors import CommunicationError
29
28
30 class VCSCommunicationError(Exception):
29 class VCSCommunicationError(Exception):
31 pass
30 pass
General Comments 0
You need to be logged in to leave comments. Login now