@mark1russell7/service 0.8.11 → 0.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -726,7 +726,7 @@ const watcher = watchTargets(
726
726
  - `fakeProcess({ flush, clock })` gives a process port that takes signals and process triggers from a test (`signal(name)`, `trigger(name)`). It keeps each exit code in place of an exit. `flush` is its flush of the output, and `log` gives the time of each flush and each exit. `holds` is the count of holds of the process, and `heldAtExit` gives that count at each exit. `message(value)` sends a message of the IPC channel.
727
727
  - `seeded(seed)` gives a seeded random number generator for the jitter (`start({ random })`).
728
728
  - `scriptedCheck(behavior)` gives a check whose behavior a test sets: `"ok"`, `"error"`, `"indeterminate"`, `"throw"`, `"timeout"` or `"hang"`.
729
- - `quietServer()` starts a TCP echo server that can go quiet. Its connections stay open while it is quiet, as with a frozen peer.
729
+ - `quietServer()` starts a TCP echo server that can go quiet. Its connections stay open while it is quiet, as with a frozen peer. `close()` resolves after the close of each connection, thus `connections` is 0 at that time.
730
730
  - `detachedLifecycle()` gives a lifecycle with no service, for the start of a transport in a test.
731
731
  - `fakeHost(options)` gives the ports of the host entry on a fake clock, a fake file system and fake processes. It records each command and each signal. A test ends a child with `exit(code)`, and `polite` makes each child obey a staged stop.
732
732
  - `transportConformance(make, options)` generates the conformance test of a transport. `make` gives a subject: the transport, a way to offer new work and a way to hold work in flight. The cases check that `stopIntake` refuses new work, and that the count is correct and comes from events. They also check that `drain` holds to its deadline and gives the cooperative abort, and that `close` is idempotent and bounded. The fake clock makes the cases fast, and the real clock measures them. The option `streams` adds six cases of the streams (S6 D4). Then the subject also gives `call`, which sends the work of the kit through `life.request`. A unary call gives one value and its status. A stream stays in flight until its end, and a failure after its first item is an error line, not a status. The drain waits for an open stream, and its cooperative abort and its cut end the stream with an end that the caller gets.
package/build/grpc.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-mIW1qgEE.js";
1
+ import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-BhVeHr_m.js";
2
2
  import { realClock } from "./clock.js";
3
3
  import { i as heartbeatDetection } from "./timing-DZl36uXs.js";
4
4
  // src/grpc/connection.ts
package/build/host.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { d as poller, f as latch, s as isMessageShape } from "./process-7R9M29wN.js";
2
2
  import { backoffProblems } from "./backoff.js";
3
- import { t as retrier } from "./retrier-BObZq10-.js";
3
+ import { t as retrier } from "./retrier-Dnjhvxol.js";
4
4
  import { realClock } from "./clock.js";
5
5
  import { convertible, formatDuration, isQuantity, valueIn } from "@mark1russell7/quantity";
6
+ import { delay } from "@mark1russell7/algebra/clock";
6
7
  import { connect } from "node:net";
7
8
  import { escapeAttribute } from "@mark1russell7/text";
8
9
  import { execFile, spawn } from "node:child_process";
@@ -342,7 +343,6 @@ const parseLockOwner = (text) => {
342
343
  const lockText = (owner) => `${JSON.stringify(owner)}\n`;
343
344
  /** This function tells if the owner of a lock is alive: its process, or its child. */
344
345
  const ownerAlive = async (owner, ports) => await sameProcess(owner, ports) || owner.child !== void 0 && await sameProcess(owner.child, ports);
345
- const sleep = (ports, ms) => new Promise((resolve) => ports.clock.after(ms, resolve));
346
346
  /**
347
347
  * This function removes a file only when it has this text: a lock file or a discovery file. The
348
348
  * removal holds the removal lock `<path>.rm` for its read and its delete. Thus two processes that find
@@ -433,7 +433,7 @@ const acquireInstanceLock = async (path, ports, options = {}) => {
433
433
  if (other === null) {
434
434
  malformed += 1;
435
435
  if (malformed < tries) {
436
- await sleep(ports, pause);
436
+ await delay(ports.clock, pause);
437
437
  continue;
438
438
  }
439
439
  if (await removeIfSame(path, found, ports)) recovered = "the lock file was not a lock record";