Products
EPiServer.Find: 13.4.4
CMS 11.20.6
.NET 4.8
Background
In a scheduled job we are running the method:
BulkResult Index(IEnumerable objectsToIndex);
Lately we receive a whole lot of:
EPiServer.Find.ServiceException: The operation has timed out ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at EPiServer.Find.Connection.JsonRequest.GetResponseStream()
at EPiServer.Find.Api.Command.GetResponse[TResult](IJsonRequest request)
--- End of inner exception stack trace ---
at EPiServer.Find.Api.Command.GetResponse[TResult](IJsonRequest request)
at EPiServer.Find.Api.CommandBase`3.Execute(IJsonRequest request)
at EPiServer.Find.Api.CommandBase`3.Execute()
at EPiServer.Find.Client.IndexDirectly(IEnumerable objectsToIndex, Boolean deleteLanguageRoutingDuplicatesOnIndex)
at EPiServer.Find.Client.Index(IEnumerable objectsToIndex)
Digging deeper I noticed we are having a defaultRequestTimeout
set to 5000
in the web.config
.
Request
There would be a nice feature to turn the timeout up a notch in the Index
method, kind of like you've made possible for simple object Index
method.
IndexResult Index(object objectToIndex, Action<IndexCommand> commandAction);
So the Bulk-indexing could be called like:
client.Index(objectsToIndex, (command) => command.Timeout = TimeSpan.FromSeconds(30) );
That would make a lot of sense for us, defaulting on a lower timeout but tune it up when needed.
So either:
BulkResult Index(IEnumerable objectsToIndex, Action<IndexCommand> commandAction);
Or:
BulkResult Index(IEnumerable objectsToIndex, Action<BulkIndexCommand> commandAction);
Discussion
I think this would be a nice addition, on exactly the place where there is extra need of bumping the timeout
settings temporarily.
I see that we had this feature from the beginning and the property name was ExplicitRequestTimeout instead of Timeout. So we can call Index like this:
client.Index(
objectsToIndex
,
(command) => command.
ExplicitRequestTimeout = 30); // 30s