@zukhruf/election 0.8.80 → 0.8.82

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.
Files changed (2) hide show
  1. package/README.md +2 -1
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -57,6 +57,7 @@ next term: 2n
57
57
  - The directory must be on a local file system. On a network file system, `campaign` rejects with `NetworkDirectoryError`.
58
58
  - A try never blocks the process. Between two tries, a candidate waits on pushes from the leader, not on a period ([A leader that hangs](#a-leader-that-hangs)).
59
59
  - `clock` is the clock that the campaign waits on, and that measures its `timeout`, the heartbeats of a leader and the deadline of a reader. It is required. Give `globalThis` in production. A test gives a fake clock, for example `createClock()` of `@sinonjs/fake-timers`, and moves the time of the campaign without a real wait ([`@zukhruf/async`](../async/README.md#run-a-wait-on-a-clock)).
60
+ - To run a job each time this process leads, and to campaign again after each term, use `LeaderSelector` of `@zukhruf/mutex`. It resigns the term when the job ends, and its dispose waits for the job ([Run a job in only one process](../mutex/docs/recipes/run-a-job-in-only-one-process.md)).
60
61
 
61
62
  ## A leader that hangs
62
63
 
@@ -302,7 +303,7 @@ export { LeaseLostError } from '@zukhruf/lease';
302
303
  ## Documentation
303
304
 
304
305
  - [How SqliteElection elects a leader](./docs/concepts/leader-election.md)
305
- - [Recipe: Run a job in only one process](./docs/recipes/singleton-job-with-leader-election.md)
306
+ - [Recipe: Run a job in only one process](../mutex/docs/recipes/run-a-job-in-only-one-process.md), with `LeaderSelector` of `@zukhruf/mutex`
306
307
  - [Own one item at a time, and skip an item that another process owns](./docs/recipes/skip-work-that-another-process-owns.md)
307
308
  - [ADR 0001: Leader election is a package, and each backend is a subclass of one campaign](./docs/adr/0001-leader-election-is-a-package-and-each-backend-is-a-subclass.md)
308
309
  - [ADR 0002: A term is a lease on leadership, with no fencing](./docs/adr/0002-a-term-is-a-lease-on-leadership-with-no-fencing.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/election",
3
- "version": "0.8.80",
3
+ "version": "0.8.82",
4
4
  "description": "Elects a leader among candidates. Each term has a higher epoch and ends when the leader resigns or dies. Backends subclass one campaign. `SqliteElection` elects among processes of one host; candidates and observers end a leader whose pipe heartbeats stop.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,13 +40,13 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@zukhruf/async": "^0.8.80",
44
- "@zukhruf/fs": "^0.8.80",
45
- "@zukhruf/lease": "^0.8.80",
46
- "@zukhruf/pipes": "^0.8.80"
43
+ "@zukhruf/async": "^0.8.82",
44
+ "@zukhruf/fs": "^0.8.82",
45
+ "@zukhruf/lease": "^0.8.82",
46
+ "@zukhruf/pipes": "^0.8.82"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@sinonjs/fake-timers": "15.5.0",
50
- "@zukhruf/testing": "^0.8.80"
50
+ "@zukhruf/testing": "^0.8.82"
51
51
  }
52
52
  }