Skip to content

Commit

Permalink
Update JediHTTP
Browse files Browse the repository at this point in the history
Make JediHTTP shut itself down after 30 minutes of inactivity.
  • Loading branch information
micbou committed Dec 21, 2017
1 parent 58ccfde commit babf195
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions ycmd/completers/python/jedi_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@

HMAC_SECRET_LENGTH = 16
JEDIHTTP_HMAC_HEADER = 'x-jedihttp-hmac'
JEDIHTTP_IDLE_SUICIDE_SECONDS = 1800 # 30 minutes
BINARY_NOT_FOUND_MESSAGE = ( 'The specified python interpreter {0} ' +
'was not found. Did you specify it correctly?' )
LOGFILE_FORMAT = 'jedihttp_{port}_{std}_'
PATH_TO_JEDIHTTP = os.path.abspath(
os.path.join( os.path.dirname( __file__ ), '..', '..', '..',
'third_party', 'JediHTTP', 'jedihttp.py' ) )
'third_party', 'JediHTTP', 'jedihttp' ) )


class JediCompleter( Completer ):
Expand Down Expand Up @@ -167,11 +168,13 @@ def _StartServer( self ):
json.dump( { 'hmac_secret': ToUnicode(
b64encode( self._hmac_secret ) ) },
hmac_file )
command = [ self._python_binary_path,
PATH_TO_JEDIHTTP,
'--port', str( self._jedihttp_port ),
'--log', self._GetLoggingLevel(),
'--hmac-file-secret', hmac_file.name ]
command = [
self._python_binary_path,
PATH_TO_JEDIHTTP,
'--port', str( self._jedihttp_port ),
'--log', self._GetLoggingLevel(),
'--hmac-file-secret', hmac_file.name,
'--idle-suicide-seconds', str( JEDIHTTP_IDLE_SUICIDE_SECONDS ) ]

self._logfile_stdout = utils.CreateLogfile(
LOGFILE_FORMAT.format( port = self._jedihttp_port, std = 'stdout' ) )
Expand Down

0 comments on commit babf195

Please sign in to comment.