Option "shutdown_secs" is now "suicide_secs"

Calling the option server_idle_suicide_seconds should be easier to understand.
This commit is contained in:
Strahinja Val Markovic 2013-10-23 12:33:27 -07:00
parent b2aa5e3d3f
commit 4af2ba0faa
4 changed files with 11 additions and 11 deletions

View File

@ -109,8 +109,8 @@ let g:ycm_server_log_level =
let g:ycm_server_keep_logfiles =
\ get( g:, 'ycm_server_keep_logfiles', 0 )
let g:ycm_server_idle_shutdown_seconds =
\ get( g:, 'ycm_server_idle_shutdown_seconds', 43200 )
let g:ycm_server_idle_suicide_seconds =
\ get( g:, 'ycm_server_idle_suicide_seconds', 43200 )
" On-demand loading. Let's use the autoload folder and not slow down vim's

View File

@ -29,7 +29,7 @@ from threading import Thread, Lock
# The idea here is to decorate every route handler automatically so that on
# every request, we log when the request was made. Then a watchdog thread checks
# every check_interval_seconds whether the server has been idle for a time
# greater that the passed-in idle_shutdown_seconds. If it has, we kill the
# greater that the passed-in idle_suicide_seconds. If it has, we kill the
# server.
#
# We want to do this so that if something goes bonkers in Vim and the server
@ -40,13 +40,13 @@ class WatchdogPlugin( object ):
def __init__( self,
idle_shutdown_seconds,
idle_suicide_seconds,
check_interval_seconds = 60 * 10 ):
self._check_interval_seconds = check_interval_seconds
self._idle_shutdown_seconds = idle_shutdown_seconds
self._idle_suicide_seconds = idle_suicide_seconds
self._last_request_time = time.time()
self._last_request_time_lock = Lock()
if idle_shutdown_seconds <= 0:
if idle_suicide_seconds <= 0:
return
self._watchdog_thread = Thread( target = self._WatchdogMain )
self._watchdog_thread.daemon = True
@ -66,7 +66,7 @@ class WatchdogPlugin( object ):
def _WatchdogMain( self ):
while True:
time.sleep( self._check_interval_seconds )
if time.time() - self._GetLastRequestTime() > self._idle_shutdown_seconds:
if time.time() - self._GetLastRequestTime() > self._idle_suicide_seconds:
utils.TerminateProcess( os.getpid() )

View File

@ -56,7 +56,7 @@ def Main():
parser.add_argument( '--log', type = str, default = 'info',
help = 'log level, one of '
'[debug|info|warning|error|critical]' )
parser.add_argument( '--idle_shutdown_seconds', type = int, default = 0,
parser.add_argument( '--idle_suicide_seconds', type = int, default = 0,
help = 'num idle seconds before server shuts down')
parser.add_argument( '--options_file', type = str, default = '',
help = 'file with user options, in JSON format' )
@ -85,7 +85,7 @@ def Main():
from ycm.server import handlers
handlers.UpdateUserOptions( options )
SetUpSignalHandler()
handlers.app.install( WatchdogPlugin( args.idle_shutdown_seconds ) )
handlers.app.install( WatchdogPlugin( args.idle_suicide_seconds ) )
waitress.serve( handlers.app,
host = args.host,
port = args.port,

View File

@ -70,8 +70,8 @@ class YouCompleteMe( object ):
'--port={0}'.format( server_port ),
'--options_file={0}'.format( options_file.name ),
'--log={0}'.format( self._user_options[ 'server_log_level' ] ),
'--idle_shutdown_seconds={0}'.format(
self._user_options[ 'server_idle_shutdown_seconds' ] ) ]
'--idle_suicide_seconds={0}'.format(
self._user_options[ 'server_idle_suicide_seconds' ] ) ]
BaseRequest.server_location = 'http://localhost:' + str( server_port )