Skip to content

Commit

Permalink
fix: delay on daily ping
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaser committed Aug 25, 2024
1 parent f1fa28b commit 82763d0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/usr/local/emhttp/plugins/tailscale/include/daily/ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ function send_usage($url, $content)
'bool5' => $exit
);

logmsg("Sending usage data");
$attempts = 0;
$delay = 0;
$delay = rand(0, 300);
do {
sleep(rand($delay, $delay + 60));
$delay = 300;

logmsg("Waiting for {$delay} seconds before sending usage data.");
sleep($delay);
$delay += 300;
$attempts++;

$result = send_usage($endpoint, $content);
logmsg("Usage data sent.");
} while (($result != '200') && ($attempts < 3));

if ($result != '200') {
Expand Down

0 comments on commit 82763d0

Please sign in to comment.