我正在使用Haskell的wreq
库发出多个GET请求。我想处理重试次数有限的连接错误。我觉得这样的事情会奏效:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License?);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
但它不时失败并出现以下错误:
getRetried url = retried 0
where maxRetries = 2
retried retries | retries >= maxRetries = throwError $ error "number of retries exceeded"
| otherwise = catchError (get url) (\_ -> (putStrLn "retrying") >> (retried (retries + 1) ) )
我错过了什么? *** Exception: InternalIOException recv: resource vanished (Connection reset by peer)
不是处理错误的正确方法吗?