Skip to content

Commit b3db6e1

Browse files
authored
Merge pull request #189 from dave-gray101/feat-connect-timeout
Feat: Connect Timeout
2 parents 267c486 + 7cf1b97 commit b3db6e1

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/manual-detached-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
with:
1111
limit-access-to-actor: true
1212
detached: true
13+
connect-timeout-seconds: 60
1314
- run: |
1415
echo "A busy loop"
1516
for value in $(seq 10)

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: 'In detached mode, the workflow job will continue while the tmate session is active'
2626
required: false
2727
default: 'false'
28+
connect-timeout-seconds:
29+
description: 'How long in seconds to wait for a connection to be established'
30+
required: false
31+
default: '600'
2832
tmate-server-host:
2933
description: 'The hostname for your tmate server (e.g. ssh.example.org)'
3034
required: false

lib/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17435,7 +17435,13 @@ async function run() {
1743517435
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
1743617436
}
1743717437
})()
17438-
for (let seconds = 10 * 60; seconds > 0; ) {
17438+
17439+
let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds"))
17440+
if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) {
17441+
connectTimeoutSeconds = 10 * 60
17442+
}
17443+
17444+
for (let seconds = connectTimeoutSeconds; seconds > 0; ) {
1743917445
console.log(`${
1744017446
await hasAnyoneConnectedYet()
1744117447
? 'Waiting for session to end'

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ export async function run() {
4949
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
5050
}
5151
})()
52-
for (let seconds = 10 * 60; seconds > 0; ) {
52+
53+
let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds"))
54+
if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) {
55+
connectTimeoutSeconds = 10 * 60
56+
}
57+
58+
for (let seconds = connectTimeoutSeconds; seconds > 0; ) {
5359
console.log(`${
5460
await hasAnyoneConnectedYet()
5561
? 'Waiting for session to end'

0 commit comments

Comments
 (0)