mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
Getwork delay in stats should include retries for each getwork call.
This commit is contained in:
parent
8c4b11f276
commit
4e60a62ae2
@ -1837,16 +1837,15 @@ static bool get_upstream_work(struct work *work, CURL *curl)
|
|||||||
|
|
||||||
url = pool->rpc_url;
|
url = pool->rpc_url;
|
||||||
|
|
||||||
|
gettimeofday(&tv_start, NULL);
|
||||||
retry:
|
retry:
|
||||||
/* A single failure response here might be reported as a dead pool and
|
/* A single failure response here might be reported as a dead pool and
|
||||||
* there may be temporary denied messages etc. falsely reporting
|
* there may be temporary denied messages etc. falsely reporting
|
||||||
* failure so retry a few times before giving up */
|
* failure so retry a few times before giving up */
|
||||||
while (!val && retries++ < 3) {
|
while (!val && retries++ < 3) {
|
||||||
pool_stats->getwork_attempts++;
|
pool_stats->getwork_attempts++;
|
||||||
gettimeofday(&tv_start, NULL);
|
|
||||||
val = json_rpc_call(curl, url, pool->rpc_userpass, rpc_req,
|
val = json_rpc_call(curl, url, pool->rpc_userpass, rpc_req,
|
||||||
false, false, &work->rolltime, pool, false);
|
false, false, &work->rolltime, pool, false);
|
||||||
gettimeofday(&tv_end, NULL);
|
|
||||||
}
|
}
|
||||||
if (unlikely(!val)) {
|
if (unlikely(!val)) {
|
||||||
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|
||||||
@ -1856,11 +1855,13 @@ retry:
|
|||||||
rc = work_decode(json_object_get(val, "result"), work);
|
rc = work_decode(json_object_get(val, "result"), work);
|
||||||
if (!rc && retries < 3)
|
if (!rc && retries < 3)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
work->pool = pool;
|
work->pool = pool;
|
||||||
work->longpoll = false;
|
work->longpoll = false;
|
||||||
total_getworks++;
|
total_getworks++;
|
||||||
pool->getwork_requested++;
|
pool->getwork_requested++;
|
||||||
|
|
||||||
|
gettimeofday(&tv_end, NULL);
|
||||||
timersub(&tv_end, &tv_start, &tv_elapsed);
|
timersub(&tv_end, &tv_start, &tv_elapsed);
|
||||||
timeradd(&tv_elapsed, &(pool_stats->getwork_wait), &(pool_stats->getwork_wait));
|
timeradd(&tv_elapsed, &(pool_stats->getwork_wait), &(pool_stats->getwork_wait));
|
||||||
if (timercmp(&tv_elapsed, &(pool_stats->getwork_wait_max), >)) {
|
if (timercmp(&tv_elapsed, &(pool_stats->getwork_wait_max), >)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user