mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-10 14:04: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);
|
switch_pools(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long requested_tv_sec;
|
static time_t requested_tv_sec;
|
||||||
|
|
||||||
static bool queue_request(struct thr_info *thr, bool needed)
|
static bool queue_request(struct thr_info *thr, bool needed)
|
||||||
{
|
{
|
||||||
int rq = requests_queued();
|
int rq = requests_queued();
|
||||||
struct workio_cmd *wc;
|
struct workio_cmd *wc;
|
||||||
struct timeval now;
|
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);
|
gettimeofday(&now, NULL);
|
||||||
|
|
||||||
/* Space out retrieval of extra work according to the number of mining
|
/* Test to make sure we have enough work for pools without rolltime
|
||||||
* threads */
|
* and enough original work for pools with rolltime */
|
||||||
if (rq >= mining_threads + staged_extras &&
|
if (rq >= mining_threads && rq > staged_extras + opt_queue &&
|
||||||
(now.tv_sec - requested_tv_sec) < opt_scantime / (mining_threads + 1))
|
now.tv_sec - requested_tv_sec < scan_post)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* fill out work request message */
|
/* fill out work request message */
|
||||||
@ -4329,7 +4336,7 @@ static void age_work(void)
|
|||||||
{
|
{
|
||||||
int discarded = 0;
|
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);
|
struct work *work = hash_pop(NULL);
|
||||||
|
|
||||||
if (unlikely(!work))
|
if (unlikely(!work))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user