feat: run jobs on instance creation when run_on_create is enabled
Jobs with run_on_create=true in their config fire automatically after a new instance is created. Runs fire-and-forget so they don't delay the 201 response. Option exposed as a checkbox in each job's detail panel. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
getConfig, setConfig, getJobs, getJob, updateJob, getJobRuns,
|
||||
getAllJobs, getAllJobRuns, importJobs,
|
||||
} from './db.js';
|
||||
import { runJob, restartJobs } from './jobs.js';
|
||||
import { runJob, restartJobs, runJobsOnCreate } from './jobs.js';
|
||||
|
||||
export const router = Router();
|
||||
|
||||
@@ -102,6 +102,7 @@ router.post('/instances', (req, res) => {
|
||||
createInstance(data);
|
||||
const created = getInstance(data.vmid);
|
||||
res.status(201).json(created);
|
||||
runJobsOnCreate().catch(() => {});
|
||||
} catch (e) {
|
||||
handleDbError('POST /api/instances', e, res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user