diff --git a/action/editcommit.php b/action/editcommit.php index ac2bae9..6266217 100644 --- a/action/editcommit.php +++ b/action/editcommit.php @@ -182,6 +182,9 @@ public function handlePeriodicPull(Event &$event, $param) //if it is time to run a pull request if ($lastPull + $timeToWait < $now) { + // Throttle by last attempt, not just last success, to avoid retrying + // on every HTTP request while the remote is unavailable. + file_put_contents($lastPullFile, serialize($now)); try { $repo = $this->initRepo(); if ($enableIndexUpdate) { @@ -225,9 +228,6 @@ public function handlePeriodicPull(Event &$event, $param) } return; } - - //save the current time to the file to track the last pull execution - file_put_contents($lastPullFile, serialize(time())); } } }