@floomhq/floom 1.0.48 → 1.0.49
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/dist/sync-manifest.js +9 -2
- package/package.json +1 -1
package/dist/sync-manifest.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { constants, rmSync } from "node:fs";
|
|
2
|
-
import { lstat, mkdir, open, rename, rm, stat } from "node:fs/promises";
|
|
2
|
+
import { lstat, mkdir, open, rename, rm, stat, utimes } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { CONFIG_DIR } from "./config.js";
|
|
6
6
|
const MANIFEST_VERSION = 1;
|
|
7
|
-
const LOCK_TIMEOUT_MS = 60_000;
|
|
7
|
+
const LOCK_TIMEOUT_MS = 6 * 60_000;
|
|
8
8
|
const LOCK_STALE_MS = 5 * 60_000;
|
|
9
|
+
const LOCK_HEARTBEAT_MS = 30_000;
|
|
9
10
|
const SLUG_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
10
11
|
const FD_PATH_ROOT = "/proc/self/fd";
|
|
11
12
|
const SUPPORT_DIRS = new Set([
|
|
@@ -277,10 +278,16 @@ export async function withSyncLock(fn) {
|
|
|
277
278
|
signalHandlers.set(signal, handler);
|
|
278
279
|
process.once(signal, handler);
|
|
279
280
|
}
|
|
281
|
+
const heartbeat = setInterval(() => {
|
|
282
|
+
const now = new Date();
|
|
283
|
+
void utimes(lockPath, now, now).catch(() => { });
|
|
284
|
+
}, LOCK_HEARTBEAT_MS);
|
|
285
|
+
heartbeat.unref?.();
|
|
280
286
|
try {
|
|
281
287
|
return await fn();
|
|
282
288
|
}
|
|
283
289
|
finally {
|
|
290
|
+
clearInterval(heartbeat);
|
|
284
291
|
for (const [signal, handler] of signalHandlers) {
|
|
285
292
|
process.off(signal, handler);
|
|
286
293
|
}
|