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

Function persistHealthResult

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

Source from the content-addressed store, hash-verified

4355 * `deadGrantVerdict` answers from `provider_state`, which no verdict
4356 * write touches. Best-effort, like every verdict write. */
4357 const persistHealthResult = (
4358 ref: ConnectionRef,
4359 observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
4360 result: HealthCheckResult,
4361 ): Effect.Effect<void, never> =>
4362 core
4363 .updateMany("connection", {
4364 where: (b: AnyCb) =>
4365 b.and(
4366 b("owner", "=", String(ref.owner)),
4367 b("integration", "=", String(ref.integration)),
4368 b("name", "=", String(ref.name)),
4369 b("updated_at", "=", observed.updated_at),
4370 observed.tools_synced_at == null
4371 ? b.isNull("tools_synced_at")
4372 : b("tools_synced_at", "=", observed.tools_synced_at),
4373 ),
4374 set: { last_health: result, updated_at: new Date() },
4375 })
4376 .pipe(Effect.ignore);
4377
4378 /** Heal-on-use: a successful invocation is stronger evidence about the
4379 * 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