* Manually trigger a job (runs immediately, ignoring cron schedule).
(id: string)
| 477 | }; |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * Manually trigger a job (runs immediately, ignoring cron schedule). |
| 482 | */ |
| 483 | async triggerJob(id: string): Promise<{ success: boolean; message: string }> { |
| 484 | const job = this.jobs.get(id); |
| 485 | if (!job) { |
| 486 | return { success: false, message: `Job "${id}" not found.` }; |
| 487 | } |
| 488 | |
| 489 | const { text, notifyFailed } = await this.runJob(job.config); |
| 490 | |
| 491 | if (!text) { |
| 492 | return { |
| 493 | success: true, |
| 494 | message: `Job "${job.config.name}" triggered but produced no output.`, |
| 495 | }; |
| 496 | } |
| 497 | if (notifyFailed) { |
| 498 | return { |
| 499 | success: true, |
| 500 | message: `Job "${job.config.name}" executed, but notification to ${job.config.notify.adapter} failed. Check logs.`, |
| 501 | }; |
| 502 | } |
| 503 | return { |
| 504 | success: true, |
| 505 | message: `Job "${job.config.name}" triggered. Result sent to ${job.config.notify.adapter}.`, |
| 506 | }; |
no test coverage detected