From 3f4fa0674d8489cdfc69728840e430a09c019e53 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 8 Oct 2020 15:06:27 +0100 Subject: [PATCH] update deployment quota after deploy --- packages/server/src/api/controllers/deploy/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/deploy/index.js b/packages/server/src/api/controllers/deploy/index.js index c5d1169962..7f6e4588a5 100644 --- a/packages/server/src/api/controllers/deploy/index.js +++ b/packages/server/src/api/controllers/deploy/index.js @@ -46,8 +46,12 @@ async function getCurrentInstanceQuota(instanceId) { }) ) const existingRecords = records.rows.length + + const designDoc = await db.get("_design/database") + return { records: existingRecords, + views: Object.keys(designDoc.views).length, } } @@ -88,7 +92,7 @@ exports.deployApp = async function(ctx) { const deployedInstanceQuota = await getCurrentInstanceQuota( ctx.user.instanceId ) - updateDeploymentQuota(deployedInstanceQuota) + await updateDeploymentQuota(deployedInstanceQuota) ctx.body = { status: "SUCCESS",