@floomhq/floom 1.0.47 → 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/dist/sync.js +2 -1
- 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
|
}
|
package/dist/sync.js
CHANGED
|
@@ -14,6 +14,7 @@ const SLUG_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
|
14
14
|
const PATH_SEGMENT_RE = /^[a-z0-9._-]{1,128}$/;
|
|
15
15
|
const MANIFEST_SEGMENT_RE = /^[A-Za-z0-9._-]{1,128}$/;
|
|
16
16
|
const FD_PATH_ROOT = "/proc/self/fd";
|
|
17
|
+
const PACKAGE_SYNC_PAGE_LIMIT = "25";
|
|
17
18
|
function sha256(input) {
|
|
18
19
|
return createHash("sha256").update(input).digest("hex");
|
|
19
20
|
}
|
|
@@ -449,7 +450,7 @@ async function loadSyncPayload(apiUrl, token) {
|
|
|
449
450
|
const seenCursors = new Set();
|
|
450
451
|
for (let page = 0; page < 1000; page += 1) {
|
|
451
452
|
const url = new URL(`${apiUrl}/api/v1/me/skills`);
|
|
452
|
-
url.searchParams.set("limit",
|
|
453
|
+
url.searchParams.set("limit", PACKAGE_SYNC_PAGE_LIMIT);
|
|
453
454
|
url.searchParams.set("packages", "1");
|
|
454
455
|
if (cursor)
|
|
455
456
|
url.searchParams.set("cursor", cursor);
|