mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
27 lines
772 B
TypeScript
27 lines
772 B
TypeScript
import { HealthStatus } from "../../../base/lib/types"
|
|
|
|
/**
|
|
* Input state provided to trigger functions.
|
|
* Contains information about the health check's current state
|
|
* that triggers can use to adjust their timing behavior.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* const myTrigger: Trigger = (getInput) => {
|
|
* return (async function* () {
|
|
* while (true) {
|
|
* const input: TriggerInput = getInput()
|
|
* // Check more frequently if last result was failure
|
|
* const delay = input.lastResult === 'failure' ? 1000 : 30000
|
|
* await new Promise(r => setTimeout(r, delay))
|
|
* yield
|
|
* }
|
|
* })()
|
|
* }
|
|
* ```
|
|
*/
|
|
export type TriggerInput = {
|
|
/** The result of the most recent health check execution, if any */
|
|
lastResult?: HealthStatus
|
|
}
|