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. 9
      main.c

9
main.c

@ -1986,8 +1986,9 @@ static inline struct pool *select_pool(bool lagging) @@ -1986,8 +1986,9 @@ static inline struct pool *select_pool(bool lagging)
static bool get_upstream_work(struct work *work, bool lagging)
{
struct pool *pool;
json_t *val;
json_t *val = NULL;
bool rc = false;
int retries = 0;
CURL *curl;
curl = curl_easy_init();
@ -2000,7 +2001,11 @@ static bool get_upstream_work(struct work *work, bool lagging) @@ -2000,7 +2001,11 @@ static bool get_upstream_work(struct work *work, bool lagging)
if (opt_debug)
applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, 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,
false, false, &work->rolltime, pool);
if (unlikely(!val)) {
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");

Loading…
Cancel
Save