Skip to content

Commit

Permalink
Only reset retry count if WU has run for more than 5 minutes. #134
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Mar 23, 2023
1 parent 05b769f commit 67cce28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Folding@home Client Changelog

## v8.1.17
- Don't show ``1B of 1B`` for completed up/download size. #130
- Only reset retry count if WU has run for more than 5 minutes. #134

## v8.1.16
- Fix core download retry logic.
Expand Down
15 changes: 9 additions & 6 deletions src/fah/client/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,17 @@ bool Unit::hasGPU(const string &id) const {
}


uint64_t Unit::getRunTimeDelta() const {
return processStartTime ? Time::now() - processStartTime - clockSkew : 0;
}


uint64_t Unit::getRunTime() const {
// Stored ``run-time`` is run time up to the end of the last run
int64_t runTime = getU64("run-time", 0);

// If core process is currently running, add accumulated time
if (processStartTime) runTime += Time::now() - processStartTime - clockSkew;
runTime += getRunTimeDelta();

return 0 < runTime ? runTime : 0;
}
Expand Down Expand Up @@ -486,6 +491,7 @@ void Unit::processStarted() {


void Unit::processEnded() {
if (Time::SEC_PER_MIN * 5 < getRunTimeDelta()) retries = 0;
insert("run-time", getRunTime());
processStartTime = 0;
}
Expand Down Expand Up @@ -573,9 +579,6 @@ void Unit::getCore() {
void Unit::run() {
if (process.isSet()) return; // Already running

// Reset retry count
retries = 0;

// Make sure WU data exists
if (!SystemUtilities::exists(getDirectory() + "/wudata_01.dat")) {
LOG_ERROR("Missing WU data");
Expand Down Expand Up @@ -826,8 +829,8 @@ void Unit::monitorRun() {
// Update ETA, PPD and progress
string eta = TimeInterval(getETA()).toString();
uint64_t ppd = getPPD();
if (eta != getString("eta", "")) insert("eta", eta);
if (ppd != getU64 ("ppd", 0)) insert("ppd", ppd);
if (eta != getString("eta", "-")) insert("eta", eta);
if (ppd != getU64 ("ppd", -1)) insert("ppd", ppd);
setProgress(getEstimatedProgress(), 1);
} CATCH_ERROR;

Expand Down
1 change: 1 addition & 0 deletions src/fah/client/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ namespace FAH {
bool hasGPU(const std::string &id) const;
bool hasGPUs() const {return !getGPUs().empty();}

uint64_t getRunTimeDelta() const;
uint64_t getRunTime() const;
uint64_t getRunTimeEstimate() const;
double getEstimatedProgress() const;
Expand Down

0 comments on commit 67cce28

Please sign in to comment.