mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
Test we have enough work queued for pools with and without rolltime capability.
This commit is contained in:
parent
1bbc860a15
commit
efa9569b66
19
cgminer.c
19
cgminer.c
@ -3512,20 +3512,27 @@ static void pool_resus(struct pool *pool)
|
||||
switch_pools(NULL);
|
||||
}
|
||||
|
||||
static long requested_tv_sec;
|
||||
static time_t requested_tv_sec;
|
||||
|
||||
static bool queue_request(struct thr_info *thr, bool needed)
|
||||
{
|
||||
int rq = requests_queued();
|
||||
struct workio_cmd *wc;
|
||||
struct timeval now;
|
||||
time_t scan_post;
|
||||
|
||||
/* Grab more work every 2/3 of the scan time to avoid all work expiring
|
||||
* at the same time */
|
||||
scan_post = opt_scantime * 2 / 3;
|
||||
if (scan_post < 5)
|
||||
scan_post = 5;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
/* Space out retrieval of extra work according to the number of mining
|
||||
* threads */
|
||||
if (rq >= mining_threads + staged_extras &&
|
||||
(now.tv_sec - requested_tv_sec) < opt_scantime / (mining_threads + 1))
|
||||
/* Test to make sure we have enough work for pools without rolltime
|
||||
* and enough original work for pools with rolltime */
|
||||
if (rq >= mining_threads && rq > staged_extras + opt_queue &&
|
||||
now.tv_sec - requested_tv_sec < scan_post)
|
||||
return true;
|
||||
|
||||
/* fill out work request message */
|
||||
@ -4329,7 +4336,7 @@ static void age_work(void)
|
||||
{
|
||||
int discarded = 0;
|
||||
|
||||
while (requests_staged() > mining_threads * 4 / 3) {
|
||||
while (requests_staged() > mining_threads * 4 / 3 + opt_queue) {
|
||||
struct work *work = hash_pop(NULL);
|
||||
|
||||
if (unlikely(!work))
|
||||
|
Loading…
x
Reference in New Issue
Block a user