@vm0/runner 3.9.0 → 3.9.1
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/index.js +23 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1612,34 +1612,39 @@ var TapPool = class {
|
|
|
1612
1612
|
/**
|
|
1613
1613
|
* Clean up the TAP pool
|
|
1614
1614
|
*
|
|
1615
|
-
*
|
|
1616
|
-
*
|
|
1617
|
-
* Any remaining resources will be cleaned up by init() on next startup.
|
|
1615
|
+
* Releases all IPs and deletes all TAPs. Waits for all operations to complete
|
|
1616
|
+
* to ensure registry is properly updated before process exits.
|
|
1618
1617
|
*/
|
|
1619
|
-
cleanup() {
|
|
1618
|
+
async cleanup() {
|
|
1620
1619
|
if (!this.initialized) {
|
|
1621
1620
|
return;
|
|
1622
1621
|
}
|
|
1623
1622
|
logger4.log(`Cleaning up TAP pool (${this.queue.length} pairs)...`);
|
|
1623
|
+
const cleanupPromises = [];
|
|
1624
1624
|
for (const { tapDevice, guestIp } of this.queue) {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
)
|
|
1631
|
-
|
|
1625
|
+
cleanupPromises.push(
|
|
1626
|
+
releaseIP(guestIp).catch(() => {
|
|
1627
|
+
})
|
|
1628
|
+
);
|
|
1629
|
+
cleanupPromises.push(
|
|
1630
|
+
this.config.deleteTap(tapDevice).catch((err) => {
|
|
1631
|
+
logger4.log(
|
|
1632
|
+
`Failed to delete ${tapDevice}: ${err instanceof Error ? err.message : "Unknown"}`
|
|
1633
|
+
);
|
|
1634
|
+
})
|
|
1635
|
+
);
|
|
1632
1636
|
}
|
|
1637
|
+
await Promise.all(cleanupPromises);
|
|
1633
1638
|
this.queue = [];
|
|
1634
1639
|
this.initialized = false;
|
|
1635
1640
|
this.replenishing = false;
|
|
1636
|
-
logger4.log("TAP pool cleanup
|
|
1641
|
+
logger4.log("TAP pool cleanup complete");
|
|
1637
1642
|
}
|
|
1638
1643
|
};
|
|
1639
1644
|
var tapPool = null;
|
|
1640
1645
|
async function initTapPool(config) {
|
|
1641
1646
|
if (tapPool) {
|
|
1642
|
-
tapPool.cleanup();
|
|
1647
|
+
await tapPool.cleanup();
|
|
1643
1648
|
}
|
|
1644
1649
|
tapPool = new TapPool(config);
|
|
1645
1650
|
await tapPool.init();
|
|
@@ -1657,9 +1662,9 @@ async function releaseTap(tapDevice, guestIp, vmId) {
|
|
|
1657
1662
|
}
|
|
1658
1663
|
return tapPool.release(tapDevice, guestIp, vmId);
|
|
1659
1664
|
}
|
|
1660
|
-
function cleanupTapPool() {
|
|
1665
|
+
async function cleanupTapPool() {
|
|
1661
1666
|
if (tapPool) {
|
|
1662
|
-
tapPool.cleanup();
|
|
1667
|
+
await tapPool.cleanup();
|
|
1663
1668
|
tapPool = null;
|
|
1664
1669
|
}
|
|
1665
1670
|
}
|
|
@@ -10533,7 +10538,7 @@ async function cleanupEnvironment(resources) {
|
|
|
10533
10538
|
logger13.error(`Failed to cleanup overlay pool: ${error.message}`);
|
|
10534
10539
|
}
|
|
10535
10540
|
try {
|
|
10536
|
-
cleanupTapPool();
|
|
10541
|
+
await cleanupTapPool();
|
|
10537
10542
|
} catch (err) {
|
|
10538
10543
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10539
10544
|
errors.push(error);
|
|
@@ -11381,7 +11386,7 @@ var benchmarkCommand = new Command4("benchmark").description(
|
|
|
11381
11386
|
);
|
|
11382
11387
|
} finally {
|
|
11383
11388
|
if (poolsInitialized) {
|
|
11384
|
-
cleanupTapPool();
|
|
11389
|
+
await cleanupTapPool();
|
|
11385
11390
|
cleanupOverlayPool();
|
|
11386
11391
|
}
|
|
11387
11392
|
}
|
|
@@ -11389,7 +11394,7 @@ var benchmarkCommand = new Command4("benchmark").description(
|
|
|
11389
11394
|
});
|
|
11390
11395
|
|
|
11391
11396
|
// src/index.ts
|
|
11392
|
-
var version = true ? "3.9.
|
|
11397
|
+
var version = true ? "3.9.1" : "0.1.0";
|
|
11393
11398
|
program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
|
|
11394
11399
|
program.addCommand(startCommand);
|
|
11395
11400
|
program.addCommand(doctorCommand);
|