Browse Source

Retry before returning a failure to get upstream work as a failure to avoid false positives for pool dead.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
f10f8faefb
  1. 7
      main.c

7
main.c

@ -1986,8 +1986,9 @@ static inline struct pool *select_pool(bool lagging)
static bool get_upstream_work(struct work *work, bool lagging) static bool get_upstream_work(struct work *work, bool lagging)
{ {
struct pool *pool; struct pool *pool;
json_t *val; json_t *val = NULL;
bool rc = false; bool rc = false;
int retries = 0;
CURL *curl; CURL *curl;
curl = curl_easy_init(); curl = curl_easy_init();
@ -2000,6 +2001,10 @@ static bool get_upstream_work(struct work *work, bool lagging)
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req); applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
/* A single failure response here might be reported as a dead pool and
* there may be temporary denied messages etc. falsely reporting
* failure so retry a few times before giving up */
while (!val && retries++ < 3)
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
false, false, &work->rolltime, pool); false, false, &work->rolltime, pool);
if (unlikely(!val)) { if (unlikely(!val)) {

Loading…
Cancel
Save