Skip to content

Commit

Permalink
Increase backoff limit to 6 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Jun 25, 2024
1 parent 0735f5b commit 53c957a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Console/Commands/CheckPendingPayins.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ public function handle()
->get();

$controller = new LnAddressController();
$delayLimit = 21600; // 6 hours

foreach ($pendingPayins as $payin) {

$last_check = $payin->last_check;
$retry = $payin->retry_check;

$expectedDelaySeconds = min(10 * (2 ** $retry), 1800);
$expectedDelaySeconds = min(10 * (2 ** $retry), $delayLimit);
$last_check = $last_check instanceof Carbon ? $last_check : new Carbon($last_check);

if (now()->timestamp - $last_check->timestamp < $expectedDelaySeconds) {
Expand Down Expand Up @@ -60,7 +61,7 @@ public function handle()

Log::info('Payin settled: '.$payin->id);
} else {
$nextExpectedDelaySeconds = min(10 * (2 ** ($retry + 1)), 1800);
$nextExpectedDelaySeconds = min(10 * (2 ** ($retry + 1)), $delayLimit);
Log::info('Payin still pending: '.$payin->id.' next attempt in '.$nextExpectedDelaySeconds.' seconds');
}
}
Expand Down

0 comments on commit 53c957a

Please sign in to comment.