volumes: wait for mount during add/update
this is a better feedback mechanism for the user
This commit is contained in:
@@ -36,6 +36,8 @@ async function add(req, res, next) {
|
||||
if (typeof req.body.mountType !== 'string') return next(new HttpError(400, 'mountType must be a string'));
|
||||
if (typeof req.body.mountOptions !== 'object') return next(new HttpError(400, 'mountOptions must be a object'));
|
||||
|
||||
req.clearTimeout(); // waiting for mount can take time
|
||||
|
||||
const [error, id] = await safe(volumes.add(req.body, auditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(201, { id }));
|
||||
@@ -67,6 +69,8 @@ async function update(req, res, next) {
|
||||
if (typeof req.body.mountType !== 'string') return next(new HttpError(400, 'mountType must be a string'));
|
||||
if (typeof req.body.mountOptions !== 'object') return next(new HttpError(400, 'mountOptions must be a object'));
|
||||
|
||||
req.clearTimeout(); // waiting for mount can take time
|
||||
|
||||
const [error] = await safe(volumes.update(req.resource, req.body.mountType, req.body.mountOptions));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(200, {}));
|
||||
|
||||
Reference in New Issue
Block a user