@indigoai-us/hq-cloud 6.16.71-alpha.0 → 6.16.71-alpha.2

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.
@@ -64,7 +64,7 @@ vi.mock("readline", () => ({
64
64
  })),
65
65
  }));
66
66
  import * as readline from "readline";
67
- import { share, ServerOwnedPushPathsError, UnreachablePushPathsError, UnregisteredCompanySkillError, currentUploadBytes, FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE, parseRegisteredCompanySkillUid, _testing as shareTesting, } from "./share.js";
67
+ import { share, ServerOwnedPushPathsError, UnreachablePushPathsError, UnregisteredCompanySkillError, currentUploadBytes, FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE, parseRegisteredCompanySkillUid, setPushCollectCooperativeYieldMsForTesting, _testing as shareTesting, } from "./share.js";
68
68
  import { deleteRemoteFile, downloadFile, headRemoteFile, primeObjectTransport, primeUploads, uploadFile, uploadSymlink, WindowsSymlinkPrivilegeError, } from "../s3.js";
69
69
  import { VaultAuthError, VaultClientError, VaultConflictError, VaultPermissionDeniedError, } from "../vault-client.js";
70
70
  import { CognitoRefreshError } from "../cognito-auth.js";
@@ -10558,4 +10558,39 @@ describe("share reconcile apply checkpoint", () => {
10558
10558
  expect(store.read().cursor).toBeUndefined();
10559
10559
  });
10560
10560
  });
10561
+ describe("collectFiles time-based cooperative yield", () => {
10562
+ afterEach(() => {
10563
+ setPushCollectCooperativeYieldMsForTesting(undefined);
10564
+ });
10565
+ it("yields every 15s of walk time even when the row unit is larger than the tree", async () => {
10566
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-collect-yield-"));
10567
+ try {
10568
+ const companyRoot = path.join(tmpDir, "companies", "acme");
10569
+ fs.mkdirSync(companyRoot, { recursive: true });
10570
+ for (let index = 0; index < 3; index += 1) {
10571
+ fs.writeFileSync(path.join(companyRoot, `file-${index}.md`), "x");
10572
+ }
10573
+ setPushCollectCooperativeYieldMsForTesting(15_000);
10574
+ let now = 1_000;
10575
+ const yieldAt = [];
10576
+ await shareTesting.collectFiles([companyRoot], tmpDir, companyRoot, () => true, {
10577
+ now: () => now,
10578
+ onDirent: () => {
10579
+ now += 16_000;
10580
+ },
10581
+ cooperativeCheckpoint: async () => {
10582
+ yieldAt.push(now);
10583
+ return false;
10584
+ },
10585
+ });
10586
+ expect(yieldAt.length).toBeGreaterThan(1);
10587
+ for (let index = 1; index < yieldAt.length; index += 1) {
10588
+ expect(yieldAt[index] - yieldAt[index - 1]).toBeLessThanOrEqual(16_000);
10589
+ }
10590
+ }
10591
+ finally {
10592
+ fs.rmSync(tmpDir, { recursive: true, force: true });
10593
+ }
10594
+ });
10595
+ });
10561
10596
  //# sourceMappingURL=share.test.js.map