method MailService.prototype.isHealthy
Since 0.6.0
MailService.prototype.isHealthy(): Promise<boolean | undefined>

Reports whether the backing provider's transport is reachable right now.

Delegates to the provider's own optional probe, which is the single implementation of this question in the package — MailPlugin's health indicator reads it through here rather than reaching past the service, so the capability and the indicator cannot disagree about what reachable means (the one-capability-one-implementation rule).

The cache lives HERE, at the capability boundary, rather than in each caller. Two independent callers ask this question on one aggregate health check — the mail indicator, and notification-plugin's email channel once per configured alias — so a cache per caller would still hit the transport once per caller, which is what the caching exists to prevent. Cached here they coalesce into one call however many aliases are configured. The probe is bounded too, so a transport that stops answering cannot hold the health endpoint open; a probe that exceeds the bound or rejects resolves false — it was reached for and did not answer, which is a different fact from undefined, where it could not be asked.

Return Type

Promise<boolean | undefined>

true reachable, false contacted and unreachable, undefined when the configured provider exposes no side-effect-free probe

Usage

import { MailService } from "mail-plugin/src/index.ts";