updateServiceConfig: remove retry from platform code

This commit is contained in:
Girish Ramakrishnan
2020-09-22 21:45:22 -07:00
parent 3c565defca
commit 4da8c8d6db
4 changed files with 12 additions and 15 deletions

View File

@@ -798,7 +798,8 @@ function exportDatabase(addon, callback) {
}
function updateServiceConfig(platformConfig, callback) {
callback = callback || NOOP_CALLBACK;
assert.strictEqual(typeof platformConfig, 'object');
assert.strictEqual(typeof callback, 'function');
async.eachSeries([ 'mysql', 'postgresql', 'mail', 'mongodb', 'graphite' ], function iterator(serviceName, iteratorCallback) {
const containerConfig = platformConfig[serviceName];
@@ -812,6 +813,8 @@ function updateServiceConfig(platformConfig, callback) {
}
const args = `update --memory ${memory} --memory-swap ${memorySwap} ${serviceName}`.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
async.retry({ times: 10, interval: 60 * 1000 }, function (retryCallback) {
shell.spawn(`updateServiceConfig(${serviceName})`, '/usr/bin/docker', args, { }, retryCallback);
}, iteratorCallback);