aglio-worker 0.48.1 → 0.48.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.
Files changed (2) hide show
  1. package/agent.js +8 -9
  2. package/package.json +1 -1
package/agent.js CHANGED
@@ -28615,19 +28615,17 @@ function dockerAuthFor(image) {
28615
28615
  if (entry.registrytoken) return { registrytoken: entry.registrytoken };
28616
28616
  return void 0;
28617
28617
  }
28618
- var inFlight = /* @__PURE__ */ new WeakMap();
28618
+ var inFlight = /* @__PURE__ */ new Map();
28619
+ async function waitForImagePulls() {
28620
+ await Promise.allSettled([...inFlight.values()]);
28621
+ }
28619
28622
  async function pullDockerImage(client, image) {
28620
28623
  if (!isRegistryImage(image)) {
28621
28624
  throw new Error(
28622
28625
  `Runner image ${image} is not registry-qualified. Build it with: pnpm runner:build`
28623
28626
  );
28624
28627
  }
28625
- let pending = inFlight.get(client);
28626
- if (!pending) {
28627
- pending = /* @__PURE__ */ new Map();
28628
- inFlight.set(client, pending);
28629
- }
28630
- const existing = pending.get(image);
28628
+ const existing = inFlight.get(image);
28631
28629
  if (existing) return existing;
28632
28630
  const pull = (async () => {
28633
28631
  const stream = await client.pull(image, { authconfig: dockerAuthFor(image) });
@@ -28637,11 +28635,11 @@ async function pullDockerImage(client, image) {
28637
28635
  stream.on("error", (error62) => reject(error62));
28638
28636
  });
28639
28637
  })();
28640
- pending.set(image, pull);
28638
+ inFlight.set(image, pull);
28641
28639
  try {
28642
28640
  await pull;
28643
28641
  } finally {
28644
- pending.delete(image);
28642
+ inFlight.delete(image);
28645
28643
  }
28646
28644
  }
28647
28645
  async function ensureDockerImage(input2) {
@@ -29302,6 +29300,7 @@ async function cleanupDockerDisk(input2) {
29302
29300
  return result;
29303
29301
  }
29304
29302
  }
29303
+ await waitForImagePulls();
29305
29304
  try {
29306
29305
  const pruned = await client.pruneImages({ filters: { dangling: ["true"] } });
29307
29306
  result.danglingImagesRemoved = pruned.ImagesDeleted?.length ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aglio-worker",
3
- "version": "0.48.1",
3
+ "version": "0.48.2",
4
4
  "description": "Host machine agent for Aglio: claims jobs over the API and starts aglio-runner containers.",
5
5
  "type": "module",
6
6
  "bin": {