Skip to content

Commit cf6d305

Browse files
authored
Merge pull request #2698 from takluyver/fuzz-check-last-modified
Allow 0.5 seconds difference in file timestamps before warning of conflicting change
2 parents 97d1730 + fd34dd2 commit cf6d305

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
@@ -2731,7 +2731,10 @@ define([
27312731
return this.contents.get(this.notebook_path, {content: false}).then(
27322732
function (data) {
27332733
var last_modified = new Date(data.last_modified);
2734-
if (last_modified > that.last_modified) {
2734+
// We want to check last_modified (disk) > that.last_modified (our last save)
2735+
// In some cases the filesystem reports an inconsistent time,
2736+
// so we allow 0.5 seconds difference before complaining.
2737+
if ((last_modified.getTime() - that.last_modified.getTime()) > 500) { // 500 ms
27352738
console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
27362739
"while the current file seem to have been saved on `"+data.last_modified+"`");
27372740
if (that._changed_on_disk_dialog !== null) {

0 commit comments

Comments
 (0)