mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 15:27:53 +00:00
Retry should get_work() fail for whatever reason.
This commit is contained in:
parent
07f6de8b34
commit
56eee5f007
15
main.c
15
main.c
@ -778,16 +778,18 @@ static bool get_work(struct work *work, bool queued)
|
|||||||
struct thr_info *thr = &thr_info[0];
|
struct thr_info *thr = &thr_info[0];
|
||||||
struct work *work_heap;
|
struct work *work_heap;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
int failures = 0;
|
||||||
|
|
||||||
|
retry:
|
||||||
if (unlikely(!queued && !queue_request())) {
|
if (unlikely(!queued && !queue_request())) {
|
||||||
applog(LOG_ERR, "Failed to queue_request in get_work");
|
applog(LOG_WARNING, "Failed to queue_request in get_work");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for 1st response, or get cached response */
|
/* wait for 1st response, or get cached response */
|
||||||
work_heap = tq_pop(thr->q, NULL);
|
work_heap = tq_pop(thr->q, NULL);
|
||||||
if (unlikely(!work_heap)) {
|
if (unlikely(!work_heap)) {
|
||||||
applog(LOG_ERR, "Failed to tq_pop in get_work");
|
applog(LOG_WARNING, "Failed to tq_pop in get_work");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
dec_queued();
|
dec_queued();
|
||||||
@ -797,6 +799,15 @@ static bool get_work(struct work *work, bool queued)
|
|||||||
ret = true;
|
ret = true;
|
||||||
free(work_heap);
|
free(work_heap);
|
||||||
out:
|
out:
|
||||||
|
if (unlikely(ret == false)) {
|
||||||
|
if ((opt_retries >= 0) && (++failures > opt_retries)) {
|
||||||
|
applog(LOG_ERR, "Failed %d times to get_work");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
applog(LOG_WARNING, "Retrying after %d seconds", opt_fail_pause);
|
||||||
|
sleep(opt_fail_pause);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user