async'ify

crazy this has gone unnoticed for so long!
This commit is contained in:
Girish Ramakrishnan
2024-04-10 18:47:21 +02:00
parent 8d04374764
commit f11becfcc8
+4 -5
View File
@@ -294,17 +294,16 @@ async function setMemoryLimit(req, res, next) {
next(new HttpSuccess(202, { taskId: result.taskId }));
}
function setCpuQuota(req, res, next) {
async function setCpuQuota(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
if (typeof req.body.cpuQuota !== 'number') return next(new HttpError(400, 'cpuQuota is not a number'));
apps.setCpuQuota(req.app, req.body.cpuQuota, AuditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
const [error, result] = await safe(apps.setCpuQuota(req.app, req.body.cpuQuota, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId: result.taskId }));
});
next(new HttpSuccess(202, { taskId: result.taskId }));
}
async function setAutomaticBackup(req, res, next) {