Make AjaxDispatcher commit transactions before responding
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 12 Jan 2016 21:23:39 +0000 (13:23 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 12 Jan 2016 21:24:37 +0000 (21:24 +0000)
Some extension code appears to have sanity commit() calls
to work around this in places, which is the wrong solution.

Note that there was always the post-send commit, just not
the pre-send one that normal requests have.

Change-Id: I410a1f1097daa4f43481d1b0afbe7f467b86d254

includes/AjaxDispatcher.php

index 96892d7..c2ea582 100644 (file)
@@ -135,6 +135,9 @@ class AjaxDispatcher {
                                                $result = new AjaxResponse( $result );
                                        }
 
+                                       // Make sure DB commit succeeds before sending a response
+                                       wfGetLBFactory()->commitMasterChanges( __METHOD__ );
+
                                        $result->sendHeaders();
                                        $result->printText();