shell: no need to promise scoping

This commit is contained in:
Girish Ramakrishnan
2024-02-21 19:40:27 +01:00
parent cfd5c0f82b
commit a6f078330f
20 changed files with 105 additions and 107 deletions

View File

@@ -247,7 +247,7 @@ async function getAddressesForPort53() {
const addresses = [];
for (const phy of physicalDevices) {
const [error, output] = await safe(shell.promises.exec('getAddressesForPort53', `ip -f inet -j addr show dev ${phy.name} scope global`, {}));
const [error, output] = await safe(shell.exec('getAddressesForPort53', `ip -f inet -j addr show dev ${phy.name} scope global`, {}));
if (error) continue;
const inet = safe.JSON.parse(output) || [];
for (const r of inet) {
@@ -651,7 +651,7 @@ async function update(name, memory, memorySwap) {
// scale back db containers, if possible. this is retried because updating memory constraints can fail
// with failed to write to memory.memsw.limit_in_bytes: write /sys/fs/cgroup/memory/docker/xx/memory.memsw.limit_in_bytes: device or resource busy
for (let times = 0; times < 10; times++) {
const [error] = await safe(shell.promises.exec(`update(${name})`, `docker update --memory ${memory} --memory-swap ${memorySwap} ${name}`, {}));
const [error] = await safe(shell.exec(`update(${name})`, `docker update --memory ${memory} --memory-swap ${memorySwap} ${name}`, {}));
if (!error) return;
await timers.setTimeout(60 * 1000);
}