Skip to content

Commit

Permalink
feat(slab): wait slab until async task is over
Browse files Browse the repository at this point in the history
This is done to handle various timeouts configuration on spawn
request in Slab. Until now the timeout was set to 15 minutes. This
was fine since default spawn timeout in Slab was set to 10 minutes.
However in some cases, slab backend profiles can request a longer
duration before timeout.
Since the asynchronous task created in Slab will eventually
finish, we now simply wait for this moment.
  • Loading branch information
soonum committed Jul 17, 2024
1 parent 9e939a1 commit 447a2d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions src/slab.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ async function startInstanceRequest() {
}

async function waitForInstance(taskId, taskName) {
for (let i = 0; i < 60; i++) {
// while (true) equivalent to please ESLint
for (;;) {
await utils.sleep(15)

try {
Expand All @@ -80,19 +81,16 @@ async function waitForInstance(taskId, taskName) {
return
}
} else {
core.error(
core.setFailed(
`Failed to wait for instance (HTTP status code: ${response.status})`
)
return
}
} catch (error) {
core.error('Failed to fetch or remove instance task')
throw error
}
}

core.setFailed(
'Timeout while waiting for instance to be running after 15 mins.'
)
}

async function terminateInstanceRequest(runnerName) {
Expand Down

0 comments on commit 447a2d0

Please sign in to comment.