File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,17 @@ public function preExecuteRequest(object $event): self
7777 $ exception = null ;
7878 $ microtime1 = microtime (true );
7979 try {
80+ // Avoid error:
81+ // Failed to start the session because headers have already been sent by
82+ // "vendor/solarium/solarium/src/Core/Client/Adapter/Curl.php"
83+ // This fireAndForget() method invokes nowaitforresponserequest type solarium client plugin.
84+ // The nowaitforresponserequest type plugin
85+ // - sets "return_transfer" option to false
86+ // - sets timeout to TimeoutAwareInterface::FAST_TIMEOUT
87+ // before executing Solr command.
88+ // But it could cause error when solr is fast (or data is small) enought to send response before TimeoutAwareInterface::FAST_TIMEOUT.
89+ // So just buffer and discard.
90+ ob_start ();
8091 $ this ->client ->getAdapter ()->execute ($ request , $ event ->getEndpoint ());
8192 } catch (HttpException $ e ) {
8293 // We expect to run into a timeout.
@@ -94,6 +105,8 @@ public function preExecuteRequest(object $event): self
94105 }
95106 } catch (\Exception $ exception ) {
96107 // Throw this exception after resetting the adapter.
108+ } finally {
109+ ob_end_clean ();
97110 }
98111
99112 if ($ this ->client ->getAdapter () instanceof TimeoutAwareInterface) {
You can’t perform that action at this time.
0 commit comments