mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-10 12:41:02 +00:00
Add debug output when get_work() is blocked for an extended period and add grace time to the device's last valid work to prevent false positives for device failure.
This commit is contained in:
parent
26c4be818a
commit
7134cd7050
10
sgminer.c
10
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user