@@ -233,7 +233,7 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
233233 },
234234 version_hash = version_hash ,
235235 ignore_minified_js = jupyter_app .ignore_minified_js ,
236-
236+
237237 # rate limits
238238 iopub_msg_rate_limit = jupyter_app .iopub_msg_rate_limit ,
239239 iopub_data_rate_limit = jupyter_app .iopub_data_rate_limit ,
@@ -243,7 +243,7 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
243243 # tornado defaults are 100 MiB, we increase it to 0.5 GiB
244244 max_body_size = 512 * 1024 * 1024 ,
245245 max_buffer_size = 512 * 1024 * 1024 ,
246-
246+
247247 # authentication
248248 cookie_secret = jupyter_app .cookie_secret ,
249249 login_url = url_path_join (base_url ,'/login' ),
@@ -265,6 +265,9 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
265265
266266 # Jupyter stuff
267267 started = now ,
268+ # place for extensions to register activity
269+ # so that they can prevent idle-shutdown
270+ last_activity_times = {},
268271 jinja_template_vars = jupyter_app .jinja_template_vars ,
269272 nbextensions_path = jupyter_app .nbextensions_path ,
270273 websocket_url = jupyter_app .websocket_url ,
@@ -361,6 +364,7 @@ def last_activity(self):
361364 sources .append (self .settings ['terminal_last_activity' ])
362365 except KeyError :
363366 pass
367+ sources .extend (self .settings ['last_activity_times' ].values ())
364368 return max (sources )
365369
366370
@@ -1271,7 +1275,7 @@ def init_webapp(self):
12711275 self .session_manager , self .kernel_spec_manager ,
12721276 self .config_manager , self .extra_services ,
12731277 self .log , self .base_url , self .default_url , self .tornado_settings ,
1274- self .jinja_environment_options
1278+ self .jinja_environment_options ,
12751279 )
12761280 ssl_options = self .ssl_options
12771281 if self .certfile :
0 commit comments