Skip to content

Commit

Permalink
Merge pull request #189 from dave-gray101/feat-connect-timeout
Browse files Browse the repository at this point in the history
Feat: Connect Timeout
  • Loading branch information
dscho committed Apr 15, 2024
2 parents 267c486 + 7cf1b97 commit b3db6e1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/manual-detached-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
with:
limit-access-to-actor: true
detached: true
connect-timeout-seconds: 60
- run: |
echo "A busy loop"
for value in $(seq 10)
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ inputs:
description: 'In detached mode, the workflow job will continue while the tmate session is active'
required: false
default: 'false'
connect-timeout-seconds:
description: 'How long in seconds to wait for a connection to be established'
required: false
default: '600'
tmate-server-host:
description: 'The hostname for your tmate server (e.g. ssh.example.org)'
required: false
Expand Down
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17435,7 +17435,13 @@ async function run() {
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
}
})()
for (let seconds = 10 * 60; seconds > 0; ) {

let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds"))
if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) {
connectTimeoutSeconds = 10 * 60
}

for (let seconds = connectTimeoutSeconds; seconds > 0; ) {
console.log(`${
await hasAnyoneConnectedYet()
? 'Waiting for session to end'
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ export async function run() {
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
}
})()
for (let seconds = 10 * 60; seconds > 0; ) {

let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds"))
if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) {
connectTimeoutSeconds = 10 * 60
}

for (let seconds = connectTimeoutSeconds; seconds > 0; ) {
console.log(`${
await hasAnyoneConnectedYet()
? 'Waiting for session to end'
Expand Down

0 comments on commit b3db6e1

Please sign in to comment.