Skip to content

Commit

Permalink
Auto merge of #888 - micbou:update-jedihttp, r=puremourning
Browse files Browse the repository at this point in the history
[READY] Update JediHTTP

Make JediHTTP shut itself down after 30 minutes of inactivity.

Fixes ycm-core/YouCompleteMe#2852.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/888)
<!-- Reviewable:end -->
  • Loading branch information
zzbot authored Dec 21, 2017
2 parents f58c1f7 + babf195 commit e07d436
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 e07d436

Please sign in to comment.