@camstack/agent 1.1.22 → 1.1.24
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/{chunk-2BGDDMHB.mjs → chunk-NOCHJ6DR.mjs} +16 -3
- package/dist/chunk-NOCHJ6DR.mjs.map +1 -0
- package/dist/cli.js +15 -2
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BGDDMHB.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -216,6 +216,7 @@ var deploySwapLogger = {
|
|
|
216
216
|
child: () => deploySwapLogger,
|
|
217
217
|
withTags: () => deploySwapLogger
|
|
218
218
|
};
|
|
219
|
+
var AGENT_PROCESS_RESTART_TIMEOUT_MS = 3e4;
|
|
219
220
|
function getLocalIps() {
|
|
220
221
|
const interfaces = os2.networkInterfaces();
|
|
221
222
|
const ips = [];
|
|
@@ -609,9 +610,21 @@ function createAgentService(deps) {
|
|
|
609
610
|
},
|
|
610
611
|
restart: {
|
|
611
612
|
handler: async (ctx) => {
|
|
612
|
-
const { params } = ctx;
|
|
613
|
+
const { params, broker } = ctx;
|
|
613
614
|
const { addonId } = params;
|
|
614
|
-
|
|
615
|
+
const result = await broker.call(
|
|
616
|
+
"$process.restart",
|
|
617
|
+
{ name: addonId },
|
|
618
|
+
{ nodeID: broker.nodeID, timeout: AGENT_PROCESS_RESTART_TIMEOUT_MS }
|
|
619
|
+
);
|
|
620
|
+
if (!result.success) {
|
|
621
|
+
throw new import_moleculer.Errors.MoleculerError(
|
|
622
|
+
`$agent.restart: process restart failed for "${addonId}": ${result.reason ?? "unknown"}`,
|
|
623
|
+
500,
|
|
624
|
+
"AGENT_RESTART_FAILED"
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
return { success: true, addonId, pid: result.pid };
|
|
615
628
|
}
|
|
616
629
|
},
|
|
617
630
|
/**
|