Skip to content

Commit 60a99fd

Browse files
authored
Merge pull request #104 from SqrtMinusOne/master
Do not spam git pull if something goes wrong
2 parents 84aa20e + a81ad70 commit 60a99fd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

action/editcommit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public function handlePeriodicPull(Event &$event, $param)
182182

183183
//if it is time to run a pull request
184184
if ($lastPull + $timeToWait < $now) {
185+
// Throttle by last attempt, not just last success, to avoid retrying
186+
// on every HTTP request while the remote is unavailable.
187+
file_put_contents($lastPullFile, serialize($now));
185188
try {
186189
$repo = $this->initRepo();
187190
if ($enableIndexUpdate) {
@@ -225,9 +228,6 @@ public function handlePeriodicPull(Event &$event, $param)
225228
}
226229
return;
227230
}
228-
229-
//save the current time to the file to track the last pull execution
230-
file_put_contents($lastPullFile, serialize(time()));
231231
}
232232
}
233233
}

0 commit comments

Comments
 (0)