@noego/lock 0.0.2-dev.1 → 0.0.2-dev.3
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 +1 -1
- package/dist/transport.js +5 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ lock --version
|
|
|
26
26
|
- `lock status` is reserved for lock status. Use `lock -- status` to run an executable named `status`; use `--` also to force a numeric or dash-prefixed word to be the command.
|
|
27
27
|
- Defaults: name `default`, current directory, limit **1**, wait indefinitely, maximum hold **1 hour**. Durations are whole numbers in milliseconds or use `ms`, `s`, `m`, or `h`. `--no-wait` makes one attempt.
|
|
28
28
|
- `--dir` uses a canonical directory path. `--worktree` uses the Git top-level directory. `--repo` uses the Git common directory, shared by worktrees of one clone but not by independent clones. `--machine` shares the key for this **OS user** across all directories. Scope kinds are distinct.
|
|
29
|
-
- Places are FIFO per key in daemon arrival order.
|
|
29
|
+
- Places are FIFO per key in daemon arrival order. For the same key, limit 1 (heavy) and limit 2 (light) share at most two places, with at most one heavy holder. Two light jobs or a heavy and a light job can overlap in either arrival order; two heavy jobs cannot. Limits 3–4096 still require all live users of the key to use the same limit.
|
|
30
30
|
- A wrapped command succeeds only if it exits 0 and the daemon acknowledges normal release. After the daemon acknowledges a queue request or grant, a disconnect fails the invocation; it never reruns or resumes the command.
|
|
31
31
|
- The Rust client receives INT, TERM, HUP and QUIT directly and relays them to the command group. It mirrors the wrapped command's exit code or terminating signal and starts the command in a separate process group. It stops remaining group members on normal command exit as well as on expiry or wrapper death. Processes that leave that group are not covered. Interactive Ctrl-Z may stop the command without returning control to the shell; suspend/resume job control is not supported.
|
|
32
32
|
- Missing binary, unavailable daemon, incompatible protocol, nesting under a process that already holds the key, and acquisition failures are errors. If a job intentionally does not need the lock, run the command without `lock`; no implicit opt-out exists.
|
package/dist/transport.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { userInfo } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
3
|
+
import { isAbsolute, join } from 'node:path';
|
|
4
4
|
import { createConnection } from 'node:net';
|
|
5
5
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
6
|
export class Channel {
|
|
@@ -90,7 +90,10 @@ function dial(path) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
export async function session(binary, callback, canRetry = () => true) {
|
|
93
|
-
const
|
|
93
|
+
const override = process.env.NOEGO_LOCK_STATE_DIR;
|
|
94
|
+
if (override !== undefined && !isAbsolute(override))
|
|
95
|
+
throw new Error('NOEGO_LOCK_STATE_DIR must be absolute');
|
|
96
|
+
const path = join(override ?? join(userInfo().homedir, '.noego-lock'), 'v1', 'daemon.sock');
|
|
94
97
|
let retrySince = performance.now();
|
|
95
98
|
let lastSpawn = -Infinity;
|
|
96
99
|
let spawnError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noego/lock",
|
|
3
|
-
"version": "0.0.2-dev.
|
|
3
|
+
"version": "0.0.2-dev.3",
|
|
4
4
|
"description": "Cross-process named locks and concurrency limits for commands and Node.js",
|
|
5
5
|
"author": "Shavauhn Gabay",
|
|
6
6
|
"license": "ISC",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@noego/lock-darwin-arm64": "0.0.2-dev.
|
|
37
|
-
"@noego/lock-darwin-x64": "0.0.2-dev.
|
|
38
|
-
"@noego/lock-linux-arm64": "0.0.2-dev.
|
|
39
|
-
"@noego/lock-linux-x64": "0.0.2-dev.
|
|
36
|
+
"@noego/lock-darwin-arm64": "0.0.2-dev.3",
|
|
37
|
+
"@noego/lock-darwin-x64": "0.0.2-dev.3",
|
|
38
|
+
"@noego/lock-linux-arm64": "0.0.2-dev.3",
|
|
39
|
+
"@noego/lock-linux-x64": "0.0.2-dev.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"vitest": "^2.1.9"
|