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

Function persistHealthResult

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

Source from the content-addressed store, hash-verified

4923 * `deadGrantVerdict` answers from `provider_state`, which no verdict
4924 * write touches. Best-effort, like every verdict write. */
4925 const persistHealthResult = (
4926 ref: ConnectionRef,
4927 observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
4928 result: HealthCheckResult,
4929 ): Effect.Effect<void, never> =>
4930 core
4931 .updateMany("connection", {
4932 where: (b: AnyCb) =>
4933 b.and(
4934 b("owner", "=", String(ref.owner)),
4935 b("integration", "=", String(ref.integration)),
4936 b("name", "=", String(ref.name)),
4937 b("updated_at", "=", observed.updated_at),
4938 observed.tools_synced_at == null
4939 ? b.isNull("tools_synced_at")
4940 : b("tools_synced_at", "=", observed.tools_synced_at),
4941 ),
4942 set: { last_health: result, updated_at: new Date() },
4943 })
4944 .pipe(Effect.ignore);
4945
4946 /** Heal-on-use: a successful invocation is stronger evidence about the
4947 * 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