Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Connect Timeout #189

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading