apptask: set the memory limit based on the backup config

fixes #759
This commit is contained in:
Girish Ramakrishnan
2021-01-06 14:46:46 -08:00
parent 3bf50af09a
commit a184012205
2 changed files with 27 additions and 16 deletions
+3 -3
View File
@@ -37,9 +37,10 @@ function initializeSync() {
}
// callback is called when task is finished
function scheduleTask(appId, taskId, callback) {
function scheduleTask(appId, taskId, options, callback) {
assert.strictEqual(typeof appId, 'string');
assert.strictEqual(typeof taskId, 'string');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
if (!gInitialized) initializeSync();
@@ -72,8 +73,7 @@ function scheduleTask(appId, taskId, callback) {
scheduler.suspendJobs(appId);
// TODO: set memory limit for app backup task
tasks.startTask(taskId, { logFile, timeout: 20 * 60 * 60 * 1000 /* 20 hours */, nice: 15 }, function (error, result) {
tasks.startTask(taskId, Object.assign(options, { logFile }), function (error, result) {
callback(error, result);
delete gActiveTasks[appId];