Skip to content

Commit fd34dd2

Browse files
committed
Allow 0.5 seconds difference in file timestamps before warning of conflicting changes
See gh-484
1 parent 8af8b0e commit fd34dd2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2721,7 +2721,10 @@ define([
27212721
return this.contents.get(this.notebook_path, {content: false}).then(
27222722
function (data) {
27232723
var last_modified = new Date(data.last_modified);
2724-
if (last_modified > that.last_modified) {
2724+
// We want to check last_modified (disk) > that.last_modified (our last save)
2725+
// In some cases the filesystem reports an inconsistent time,
2726+
// so we allow 0.5 seconds difference before complaining.
2727+
if ((last_modified.getTime() - that.last_modified.getTime()) > 500) { // 500 ms
27252728
console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
27262729
"while the current file seem to have been saved on `"+data.last_modified+"`");
27272730
if (that._changed_on_disk_dialog !== null) {

0 commit comments

Comments
 (0)