|
|
@@ -1572,9 +1572,9 @@ static inline struct pool *select_pool(bool lagging)
|
|
|
|
|
|
static bool get_upstream_work(struct work *work, bool lagging)
|
|
|
{
|
|
|
+ bool rc = false, req_longpoll = false;
|
|
|
struct pool *pool;
|
|
|
json_t *val = NULL;
|
|
|
- bool rc = false;
|
|
|
int retries = 0;
|
|
|
CURL *curl;
|
|
|
|
|
|
@@ -1587,13 +1587,18 @@ static bool get_upstream_work(struct work *work, bool lagging)
|
|
|
pool = select_pool(lagging);
|
|
|
applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
|
|
|
|
|
|
+ /* If this is the current pool and supports longpoll but has not sent
|
|
|
+ * a longpoll, send one now */
|
|
|
+ if (unlikely(pool == current_pool() && pool->hdr_path && !pool->lp_sent))
|
|
|
+ req_longpoll = true;
|
|
|
+
|
|
|
retry:
|
|
|
/* 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, false);
|
|
|
+ false, req_longpoll, &work->rolltime, pool, false);
|
|
|
}
|
|
|
if (unlikely(!val)) {
|
|
|
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|