Work items have a tendency to expire at exactly the same time and we don't queue extra items when there are plenty in the queue, regardless of age. Allow extra work items to be queued if adequate time has passed since we last requested work even if over the limit.
diff --git a/cgminer.c b/cgminer.c
index c2cb043..d35d236 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2902,12 +2902,18 @@ static void pool_resus(struct pool *pool)
switch_pools(NULL);
}
+static long requested_tv_sec;
+
static bool queue_request(struct thr_info *thr, bool needed)
{
- struct workio_cmd *wc;
int rq = requests_queued();
+ struct workio_cmd *wc;
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
- if (rq >= mining_threads + staged_clones)
+ if (rq >= mining_threads + staged_clones &&
+ (now.tv_sec - requested_tv_sec) > opt_scantime * 2 / 3)
return true;
/* fill out work request message */
@@ -2939,6 +2945,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
return false;
}
+ requested_tv_sec = now.tv_sec;
inc_queued();
return true;
}