Hi, I'm getting a lot of following warnings when trying to index using this module on Acquia remote environments.

The function SolrConnectorPluginBase::useTimeout() has no affect because you use a HTTP adapter that is not implementing TimeoutAwareInterface. You need to adjust your SolrConnector accordingly.

It looks like it has to something to do with the adapter being used in the file `src/Plugin/SolrConnector/AcquiaSearchSolrConnector.php` at line 207.

According to the issue comment Warning 'The function SolrConnectorPluginBase::useTimeout() has no affect ...', it looks like it's suggested to replace the adapter or overriding the useTimeout method to remove the warning?

Any help would be greatly appreciated!

Comments

sker101 created an issue. See original summary.

sker101’s picture

After testing it locally, it seems like the warning is only being thrown on the remote environments where the search server is configured to use "Acquia" as the Solr connector.

sker101’s picture

StatusFileSize
new4.43 KB

Here's a patch that creates a simple Psr18 adapter which implements the timeout aware interface.

My understanding of using the original psr18 adapter in the module is we want to use the same HTTP client as the Drupal core and there is only one adapter "PSR18 adapter" that allows the module to use the custom http client.

The new adapter would be like a wrapper of the original adapter. It implements both "AdapterInterface" and "TimeoutAwareInterface" and calls the "execute" method of the original adapter. (The old adapter has be injected to the new adapter instead of being inherited, see reason in Use of 'final' and 'private' in Psr18Adapter)

Since there is no way to modify the timeout of the HTTP client instance provided by Drupal, I try to modify the timeout value stored in the "Request" object from the "execute" method to allow the timeout to be respected instead of redeclaring the whole HTTP client.

I tested the patch on the Acquia Cloud environment and confirmed that the warnings no longer appear and the search is still functioning.

jmoreira’s picture

@sker101 We'll be releasing a fix for it this week that involves changing the adapter from PSR-18 to HTTP, which supports timeouts and sends the headers we need. I do think it would be great to support both PSR-18 and timeouts but I think this should be implemented and discussed at the Solarium library level: https://github.com/solariumphp/solarium .

jmoreira’s picture

jmoreira’s picture

Status: Active » Fixed
jmoreira’s picture

Status: Fixed » Closed (fixed)