ktmud commented on a change in pull request #11220:
URL: 
https://github.com/apache/incubator-superset/pull/11220#discussion_r502723336



##########
File path: superset/views/core.py
##########
@@ -1064,6 +1064,16 @@ def save_dash(  # pylint: disable=no-self-use
         dash = session.query(Dashboard).get(dashboard_id)
         check_ownership(dash, raise_if_false=True)
         data = json.loads(request.form["data"])
+        remote_last_modified_time = data.get("last_modified_time")
+        current_last_modified_time = 
dash.changed_on.replace(microsecond=0).timestamp()
+        # prevent mid-air collisions
+        if remote_last_modified_time < current_last_modified_time:
+            return json_error_response(
+                "This dashboard was changed recently. "
+                "Please reload dashboard to get latest version.",
+                412,
+            )
+
         DashboardDAO.set_dash_metadata(dash, data)

Review comment:
       Is this going to persist `last_modified_time` in Dashboard metadata? 
That's not what we want, is it?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to