Skip to content

Commit 364cd03

Browse files
authored
Merge pull request #3273 from gnestor/issue-484
Make buffer time between last modified on disk and last modified on last save configurable
2 parents 08a17df + 3fce87d commit 364cd03

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2738,10 +2738,12 @@ define([
27382738
return this.contents.get(this.notebook_path, {content: false}).then(
27392739
function (data) {
27402740
var last_modified = new Date(data.last_modified);
2741+
var last_modified_check_margin = (that.config.data['last_modified_check_margin'] || 0.5) * 1000; // 500 ms
27412742
// We want to check last_modified (disk) > that.last_modified (our last save)
27422743
// In some cases the filesystem reports an inconsistent time,
27432744
// so we allow 0.5 seconds difference before complaining.
2744-
if ((last_modified.getTime() - that.last_modified.getTime()) > 500) { // 500 ms
2745+
// This is configurable in nbconfig/notebook.json as `last_modified_check_margin`.
2746+
if ((last_modified.getTime() - that.last_modified.getTime()) > last_modified_check_margin) {
27452747
console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
27462748
"while the current file seem to have been saved on `"+data.last_modified+"`");
27472749
if (that._changed_on_disk_dialog !== null) {

0 commit comments

Comments
 (0)