mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Reset quotas on load balance for all pools at the same time to avoid running out during selection and unintentionally dropping to fallback.
This commit is contained in:
parent
972d04d2a8
commit
48681dd4bb
23
cgminer.c
23
cgminer.c
@ -2868,6 +2868,7 @@ static inline struct pool *select_pool(bool lagging)
|
|||||||
{
|
{
|
||||||
static int rotating_pool = 0;
|
static int rotating_pool = 0;
|
||||||
struct pool *pool, *cp;
|
struct pool *pool, *cp;
|
||||||
|
bool avail = false;
|
||||||
int tested, i;
|
int tested, i;
|
||||||
|
|
||||||
cp = current_pool();
|
cp = current_pool();
|
||||||
@ -2883,14 +2884,28 @@ static inline struct pool *select_pool(bool lagging)
|
|||||||
} else
|
} else
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < total_pools; i++) {
|
||||||
|
struct pool *tp = pools[i];
|
||||||
|
|
||||||
|
if (tp->quota_used < tp->quota_gcd) {
|
||||||
|
avail = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* There are no pools with quota, so reset them. */
|
||||||
|
if (!avail) {
|
||||||
|
for (i = 0; i < total_pools; i++)
|
||||||
|
pools[i]->quota_used = 0;
|
||||||
|
if (++rotating_pool >= total_pools)
|
||||||
|
rotating_pool = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to find the first pool in the rotation that is usable */
|
/* Try to find the first pool in the rotation that is usable */
|
||||||
tested = 0;
|
tested = 0;
|
||||||
while (!pool && tested++ < total_pools) {
|
while (!pool && tested++ < total_pools) {
|
||||||
pool = pools[rotating_pool];
|
pool = pools[rotating_pool];
|
||||||
if (pool->quota_used++ >= pool->quota_gcd) {
|
if (pool->quota_used++ < pool->quota_gcd) {
|
||||||
pool->quota_used = 0;
|
|
||||||
pool = NULL;
|
|
||||||
} else {
|
|
||||||
if (!pool_unworkable(pool))
|
if (!pool_unworkable(pool))
|
||||||
break;
|
break;
|
||||||
/* Failover-only flag for load-balance means distribute
|
/* Failover-only flag for load-balance means distribute
|
||||||
|
Loading…
x
Reference in New Issue
Block a user