如何延长 SolrConnection 中的超时? (SolrConnectionException:操作已超时)
如何扩展/修改 SolrConnection 对象的超时值?
我有一个长时间运行的优化操作,该操作似乎未在提供的默认连接超时内完成。我正在使用的操作是 ISolrOperations.Optimize()
。我没有看到任何直接使用 ISolrOperations 对象增加超时的选项。
我使用 Castle Windsor IoC 容器进行实例化,以便拥有多个核心。
以下是完整的堆栈跟踪:
SolrNet.Exceptions.SolrConnectionException: The operation has timed out ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse() in c:\prg\SolrNet\svn\HttpWebAdapters\Impl\HttpWebRequestAdapter.cs:line 36
at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 201
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 113
--- End of inner exception stack trace ---
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 121
at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 87
at SolrNet.Commands.OptimizeCommand.Execute(ISolrConnection connection) in c:\prg\SolrNet\svn\SolrNet\Commands\OptimizeCommand.cs:line 76
at SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 96
at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 106
at SolrNet.Impl.SolrBasicServer`1.Optimize(CommitOptions options) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 69
at SolrNet.Impl.SolrServer`1.Optimize() in c:\prg\SolrNet\svn\SolrNet\Impl\SolrServer.cs:line 206
at NationalLaborRelations.SearchAgent.SearchAgentBase.Optimize(ISolrOperations`1 s) in C:\PROJECTS\NLRB\Search\SearchAgent\SearchAgent\SearchAgentBase.cs:line 354
请注意,优化确实成功发生,但 SolrNet 不会等待它完成才抛出此错误。
How do I extend/modify the timeout value used for the SolrConnection object?
I have a long-running optimize operation that does not appear to complete within the default connection timeout provided. The operation I am using is ISolrOperations<?>.Optimize()
. I do not see any options for increasing the timeout using the ISolrOperations
object directly.
I am using the Castle Windsor IoC container for instantiation in order to have multiple cores.
Here is the full stacktrace:
SolrNet.Exceptions.SolrConnectionException: The operation has timed out ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse() in c:\prg\SolrNet\svn\HttpWebAdapters\Impl\HttpWebRequestAdapter.cs:line 36
at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 201
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 113
--- End of inner exception stack trace ---
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 121
at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 87
at SolrNet.Commands.OptimizeCommand.Execute(ISolrConnection connection) in c:\prg\SolrNet\svn\SolrNet\Commands\OptimizeCommand.cs:line 76
at SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 96
at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 106
at SolrNet.Impl.SolrBasicServer`1.Optimize(CommitOptions options) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 69
at SolrNet.Impl.SolrServer`1.Optimize() in c:\prg\SolrNet\svn\SolrNet\Impl\SolrServer.cs:line 206
at NationalLaborRelations.SearchAgent.SearchAgentBase.Optimize(ISolrOperations`1 s) in C:\PROJECTS\NLRB\Search\SearchAgent\SearchAgent\SearchAgentBase.cs:line 354
Note that the optimization does happen successfully, but that SolrNet does not wait for it to complete before throwing this error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以安全地忽略此超时。正如您已经发现的,该命令无论如何都能在 Solr 上成功运行。
或者,如果您想设置连接超时,您可以使用 Windsor 中的组件模型事件进行配置:
超时值以毫秒表示。
You can safely ignore this timeout. As you already have found out, the command runs successfully on Solr anyway.
Or if you want to set the connection timeout you can configure it with a component model event in Windsor:
Timeout value is expressed in milliseconds.