shell: remove usage of .spawn

This commit is contained in:
Girish Ramakrishnan
2024-02-21 13:09:59 +01:00
parent 62ca0487dc
commit 2237d2bbb7
5 changed files with 86 additions and 78 deletions

View File

@@ -648,12 +648,10 @@ async function update(name, memory, memorySwap) {
assert.strictEqual(typeof memory, 'number');
assert.strictEqual(typeof memorySwap, 'number');
const args = `update --memory ${memory} --memory-swap ${memorySwap} ${name}`.split(' ');
// 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.spawn(`update(${name})`, '/usr/bin/docker', args, { }));
const [error] = await safe(shell.promises.exec(`update(${name})`, `docker update --memory ${memory} --memory-swap ${memorySwap} ${name}`, {}));
if (!error) return;
await timers.setTimeout(60 * 1000);
}