Skip to content

Commit 01a95e9

Browse files
committed
Added TUNNELER_CONN_TRIES to poll ssh connection a configurable amount of times
1 parent a8f79d0 commit 01a95e9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

config/tunneler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'hostname' => env('TUNNELER_HOSTNAME'),
2020
'port' => env('TUNNELER_PORT'),
2121
'wait' => env('TUNNELER_CONN_WAIT', '500000'),
22+
'tries' => env('TUNNELER_CONN_TRIES', 1),
2223

2324
'on_boot' => filter_var(env('TUNNELER_ON_BOOT', false), FILTER_VALIDATE_BOOLEAN),
2425
'ssh_verbosity' => env('SSH_VERBOSITY',''),

src/Jobs/CreateTunnel.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ public function handle(): int
5858
}
5959

6060
$this->createTunnel();
61-
62-
if ($this->verifyTunnel()) {
63-
return 2;
61+
62+
$tries = config('tunneler.tries');
63+
for ($i = 0; $i < $tries; $i++) {
64+
if ($this->verifyTunnel()) {
65+
return 2;
66+
}
6467
}
6568

6669
throw new \ErrorException(sprintf("Could Not Create SSH Tunnel with command:\n\t%s\nCheck your configuration.",

0 commit comments

Comments
 (0)