From 9311ee64ab2d0cc875858338500a4c8650467401 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 9 Jun 2015 22:38:55 -0400 Subject: [PATCH] Post save delay before fetching new data to allow for postgres replication re: #2678 #2667 #1646 I cheated a bit by putting half the delay before showing success pane and half after. --- js/id/core/connection.js | 6 +++--- js/id/modes/browse.js | 2 +- js/id/modes/save.js | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/js/id/core/connection.js b/js/id/core/connection.js index b3a8bbe7c..a9957ecbc 100644 --- a/js/id/core/connection.js +++ b/js/id/core/connection.js @@ -265,9 +265,9 @@ iD.Connection = function() { }, function(err) { if (err) return callback(err); // POST was successful, safe to call the callback. - // Still attempt to close changeset, but ignore response. - // see #2667 - callback(null, changeset_id); + // Still attempt to close changeset, but ignore response because #2667 + // Add delay to allow for postgres replication #1646 #2678 + window.setTimeout(function() { callback(null, changeset_id); }, 2500); oauth.xhr({ method: 'PUT', path: '/api/0.6/changeset/' + changeset_id + '/close' diff --git a/js/id/modes/browse.js b/js/id/modes/browse.js index 9e33a1eb0..d057cbbf6 100644 --- a/js/id/modes/browse.js +++ b/js/id/modes/browse.js @@ -37,7 +37,7 @@ iD.modes.Browse = function(context) { }); if (sidebar) { - context.ui().sidebar.hide(sidebar); + context.ui().sidebar.hide(); } }; diff --git a/js/id/modes/save.js b/js/id/modes/save.js index d63a939cf..f8df7ce47 100644 --- a/js/id/modes/save.js +++ b/js/id/modes/save.js @@ -165,9 +165,12 @@ iD.modes.Save = function(context) { }); showErrors(); } else { - loading.close(); - context.flush(); success(e, changeset_id); + // Add delay to allow for postgres replication #1646 #2678 + window.setTimeout(function() { + loading.close(); + context.flush(); + }, 2500); } }); } else { // changes were insignificant or reverted by user @@ -293,8 +296,8 @@ iD.modes.Save = function(context) { id: changeset_id, comment: e.comment }) - .on('cancel', function(ui) { - context.ui().sidebar.hide(ui); + .on('cancel', function() { + context.ui().sidebar.hide(); }))); } @@ -309,7 +312,7 @@ iD.modes.Save = function(context) { }; mode.exit = function() { - context.ui().sidebar.hide(ui); + context.ui().sidebar.hide(); }; return mode;