Interface: OperationalHooksConfig<T>
Defined in: electron/utils/operationalHooks.ts:189
Configuration for operational hooks.
Type Parameters
T
T = unknown
Properties
backoff?
optionalbackoff:"linear"|"exponential"
Defined in: electron/utils/operationalHooks.ts:195
Backoff strategy for retry delays.
Default Value
"exponential";
context?
optionalcontext:OperationalHookContextInput
Defined in: electron/utils/operationalHooks.ts:200
Context data to include in events.
emitEvents?
optionalemitEvents:boolean
Defined in: electron/utils/operationalHooks.ts:207
Whether to emit events for this operation.
Default Value
true;
eventEmitter?
optionaleventEmitter:TypedEventBus<UptimeEvents>
Defined in: electron/utils/operationalHooks.ts:212
Event emitter for operation events.
failureLogLevel?
optionalfailureLogLevel:OperationalLogLevel| (error:Error,attempt:number,maxRetries:number) =>OperationalLogLevel
Defined in: electron/utils/operationalHooks.ts:224
Customize the log level used when the operation fails permanently.
Remarks
Accepts either a static level or a callback that derives the level from the caught error context. Invalid values fall back to the default setting.
Default Value
"error";
initialDelay?
optionalinitialDelay:number
Defined in: electron/utils/operationalHooks.ts:237
Initial delay between retries in milliseconds.
Default Value
100;
maxRetries?
optionalmaxRetries:number
Defined in: electron/utils/operationalHooks.ts:244
Maximum number of retry attempts.
Default Value
3;
onFailure()?
optionalonFailure: (error:Error,attempts:number) =>void|Promise<void>
Defined in: electron/utils/operationalHooks.ts:249
Callback when operation fails permanently.
Parameters
error
attempts
number
Returns
void | Promise<void>
onRetry()?
optionalonRetry: (attempt:number,error:Error) =>void|Promise<void>
Defined in: electron/utils/operationalHooks.ts:254
Callback when retry is attempted.
Parameters
attempt
number
error
Returns
void | Promise<void>
onSuccess()?
optionalonSuccess: (result:T) =>void|Promise<void>
Defined in: electron/utils/operationalHooks.ts:259
Callback when operation succeeds.
Parameters
result
T
Returns
void | Promise<void>
operationName
operationName:
string
Defined in: electron/utils/operationalHooks.ts:264
Name of the operation for logging and event emission.
signal?
optionalsignal:AbortSignal
Defined in: electron/utils/operationalHooks.ts:274
Optional cancellation signal.
Remarks
When provided, retries and retry delays will stop as soon as the signal aborts. This is primarily used by monitoring to prevent wasted work after a monitor is stopped/cancelled.
throwOnFailure?
optionalthrowOnFailure:boolean
Defined in: electron/utils/operationalHooks.ts:281
Whether to throw on final failure.
Default Value
true;