MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / persistHealthResult

Function persistHealthResult

packages/core/sdk/src/executor.ts:4917–4936  ·  view source on GitHub ↗
(
      ref: ConnectionRef,
      observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
      result: HealthCheckResult,
    )

Source from the content-addressed store, hash-verified

4915 * `deadGrantVerdict` answers from `provider_state`, which no verdict
4916 * write touches. Best-effort, like every verdict write. */
4917 const persistHealthResult = (
4918 ref: ConnectionRef,
4919 observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
4920 result: HealthCheckResult,
4921 ): Effect.Effect<void, never> =>
4922 core
4923 .updateMany("connection", {
4924 where: (b: AnyCb) =>
4925 b.and(
4926 b("owner", "=", String(ref.owner)),
4927 b("integration", "=", String(ref.integration)),
4928 b("name", "=", String(ref.name)),
4929 b("updated_at", "=", observed.updated_at),
4930 observed.tools_synced_at == null
4931 ? b.isNull("tools_synced_at")
4932 : b("tools_synced_at", "=", observed.tools_synced_at),
4933 ),
4934 set: { last_health: result, updated_at: new Date() },
4935 })
4936 .pipe(Effect.ignore);
4937
4938 /** Heal-on-use: a successful invocation is stronger evidence about the
4939 * credential than any persisted probe verdict, so flip a stale non-healthy

Callers 2

healPersistedHealthOnUseFunction · 0.85
persistProbeHealthResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected