From 6109cdc86eb6dadcd13611cc9a7d592ad8668a1b Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 12 Jan 2016 07:48:22 -0800 Subject: [PATCH] use math.ceill to allow values < 5s as input --- notebook/static/notebook/js/notebook.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 8e96e617c..a367d9558 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -2518,8 +2518,9 @@ define(function (require) { if (this.autosave_interval) { // new save interval: higher of 10x save duration or parameter (default 30 seconds) var interval = Math.max(10 * duration, this.minimum_autosave_interval); - // round to 10 seconds, otherwise we will be setting a new interval too often - interval = 10000 * Math.round(interval / 10000); + // ceil to 10 seconds, otherwise we will be setting a new interval too often + // do not round or anything below 5000ms will desactivate saving. + interval = 10000 * Math.ceil(interval / 10000); // set new interval, if it's changed if (interval !== this.autosave_interval) { this.set_autosave_interval(interval);