Skip to content

Commit a81ad70

Browse files
committed
Do not spam git pull if something goes wrong
1 parent 84aa20e commit a81ad70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)