Skip to content

Commit

Permalink
WIP: try to handle cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
soonum committed Dec 4, 2024
1 parent 8896570 commit cf52c42
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dist/index.js

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

14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ const slab = require('./slab')
const config = require('./config')
const core = require('@actions/core')
const { waitForRunnerRegistered } = require('./gh')
const utils = require('./utils')

function setOutput(label) {
core.setOutput('label', label)
}

process.on('SIGINT', async function () {
core.info('CANCEL caught !!!')
core.info('[DEBUG] About to wait 2 seconds async in cleanup')
await utils.sleep(2) // DEBUG
core.info('[DEBUG] Sleep finished')
process.exit()
})

// TODO Write a cleanup function

async function start() {
const provider = config.input.backend

Expand All @@ -33,6 +44,9 @@ async function start() {
)}`
)

core.info('[DEBUG] About to wait 30 seconds for cancelation') // DEBUG
await utils.sleep(30) // DEBUG

try {
const wait_instance_response = await slab.waitForInstance(
start_instance_response.task_id,
Expand Down

0 comments on commit cf52c42

Please sign in to comment.