From 980600d40f53a7468e11d9645239ff794eaefdc3 Mon Sep 17 00:00:00 2001 From: Gerhard Weis Date: Mon, 22 Oct 2018 08:14:22 +1000 Subject: [PATCH] record api_last_activity as timezone aware timestamp (fixes problems with notebook status api when producing last_activity timestamp) --- nbserverproxy/handlers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nbserverproxy/handlers.py b/nbserverproxy/handlers.py index fa77fc8f..7990e1e8 100644 --- a/nbserverproxy/handlers.py +++ b/nbserverproxy/handlers.py @@ -4,7 +4,6 @@ Some original inspiration from https://github.com/senko/tornado-proxy """ -from datetime import datetime import inspect import socket import os @@ -13,7 +12,7 @@ from tornado import gen, web, httpclient, httputil, process, websocket, ioloop, version_info from notebook.utils import url_path_join -from notebook.base.handlers import IPythonHandler +from notebook.base.handlers import IPythonHandler, utcnow class AddSlashHandler(IPythonHandler): @@ -194,7 +193,7 @@ def _record_activity(self): avoids proxied traffic being ignored by the notebook's internal idle-shutdown mechanism """ - self.settings['api_last_activity'] = datetime.utcnow() + self.settings['api_last_activity'] = utcnow() @web.authenticated