node-opcua-pki 6.7.1 → 6.7.3
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/bin/pki.mjs +28 -12
- package/dist/bin/pki.mjs.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/bin/pki.mjs
CHANGED
|
@@ -345,7 +345,7 @@ var init_simple_config_template_cnf = __esm({
|
|
|
345
345
|
import { EventEmitter } from "events";
|
|
346
346
|
import fs4 from "fs";
|
|
347
347
|
import path2 from "path";
|
|
348
|
-
import { withLock } from "@ster5/global-mutex";
|
|
348
|
+
import { drainPendingLocks, withLock } from "@ster5/global-mutex";
|
|
349
349
|
import chalk3 from "chalk";
|
|
350
350
|
import chokidar from "chokidar";
|
|
351
351
|
import {
|
|
@@ -908,6 +908,7 @@ var init_certificate_manager = __esm({
|
|
|
908
908
|
}
|
|
909
909
|
try {
|
|
910
910
|
this.state = 3 /* Disposing */;
|
|
911
|
+
await drainPendingLocks();
|
|
911
912
|
for (const unreff of this.#pendingUnrefs) {
|
|
912
913
|
unreff();
|
|
913
914
|
}
|
|
@@ -1446,22 +1447,31 @@ var init_certificate_manager = __esm({
|
|
|
1446
1447
|
...usePolling ? { interval: pollingInterval } : {},
|
|
1447
1448
|
persistent: false
|
|
1448
1449
|
};
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1450
|
+
const allCapturedHandles = [];
|
|
1451
|
+
const origWatch = fs4.watch;
|
|
1452
|
+
let watcherReadyCount = 0;
|
|
1453
|
+
const totalWatchers = 5;
|
|
1454
|
+
fs4.watch = ((...args) => {
|
|
1455
|
+
const handle = origWatch.apply(fs4, args);
|
|
1456
|
+
handle.setMaxListeners(handle.getMaxListeners() + 1);
|
|
1457
|
+
handle.on("error", () => {
|
|
1456
1458
|
});
|
|
1459
|
+
allCapturedHandles.push(handle);
|
|
1460
|
+
return handle;
|
|
1461
|
+
});
|
|
1462
|
+
const createUnreffedWatcher = (folder) => {
|
|
1463
|
+
const startIdx = allCapturedHandles.length;
|
|
1457
1464
|
const w = chokidar.watch(folder, chokidarOptions);
|
|
1458
1465
|
const unreffAll = () => {
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1466
|
+
for (let i = startIdx; i < allCapturedHandles.length; i++) {
|
|
1467
|
+
allCapturedHandles[i].unref();
|
|
1468
|
+
}
|
|
1469
|
+
watcherReadyCount++;
|
|
1470
|
+
if (watcherReadyCount >= totalWatchers) {
|
|
1471
|
+
fs4.watch = origWatch;
|
|
1462
1472
|
}
|
|
1463
1473
|
};
|
|
1464
|
-
return { w, capturedHandles, unreffAll };
|
|
1474
|
+
return { w, capturedHandles: allCapturedHandles.slice(startIdx), unreffAll };
|
|
1465
1475
|
};
|
|
1466
1476
|
await Promise.all([
|
|
1467
1477
|
this.#scanCertFolder(this.trustedFolder, this.#thumbs.trusted),
|
|
@@ -1523,6 +1533,9 @@ var init_certificate_manager = __esm({
|
|
|
1523
1533
|
*/
|
|
1524
1534
|
#startCrlWatcher(folder, index, createUnreffedWatcher, store) {
|
|
1525
1535
|
const { w, unreffAll } = createUnreffedWatcher(folder);
|
|
1536
|
+
w.on("error", (err) => {
|
|
1537
|
+
debugLog(`chokidar CRL watcher error on ${folder}:`, err);
|
|
1538
|
+
});
|
|
1526
1539
|
let ready = false;
|
|
1527
1540
|
w.on("unlink", (filename) => {
|
|
1528
1541
|
for (const [key, data] of index.entries()) {
|
|
@@ -1558,6 +1571,9 @@ var init_certificate_manager = __esm({
|
|
|
1558
1571
|
*/
|
|
1559
1572
|
#startWatcher(folder, index, createUnreffedWatcher, store) {
|
|
1560
1573
|
const { w, unreffAll } = createUnreffedWatcher(folder);
|
|
1574
|
+
w.on("error", (err) => {
|
|
1575
|
+
debugLog(`chokidar cert watcher error on ${folder}:`, err);
|
|
1576
|
+
});
|
|
1561
1577
|
let ready = false;
|
|
1562
1578
|
w.on("unlink", (filename) => {
|
|
1563
1579
|
debugLog(chalk3.cyan(`unlink in folder ${folder}`), filename);
|