diff --git a/sgminer.c b/sgminer.c index 753a3141..f3587f91 100644 --- a/sgminer.c +++ b/sgminer.c @@ -5912,9 +5912,11 @@ static void gen_stratum_work(struct pool *pool, struct work *work) struct work *get_work(struct thr_info *thr, const int thr_id) { struct work *work = NULL; + time_t diff_t; thread_reportout(thr); applog(LOG_DEBUG, "Popping work from get queue to get work"); + diff_t = time(NULL); while (!work) { work = hash_pop(); if (stale_work(work, false)) { @@ -5923,6 +5925,14 @@ struct work *get_work(struct thr_info *thr, const int thr_id) wake_gws(); } } + diff_t = time(NULL) - diff_t; + /* Since this is a blocking function, we need to add grace time to + * the device's last valid work to not make outages appear to be + * device failures. */ + if (diff_t > 0) { + applog(LOG_DEBUG, "Get work blocked for %d seconds", (int)diff_t); + thr->cgpu->last_device_valid_work += diff_t; + } applog(LOG_DEBUG, "Got work from get queue to get work for thread %d", thr_id); work->thr_id = thr_id;