From 7e86867de52076407ab1fffadb985e90541cb056 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Fri, 4 Nov 2016 16:15:00 +0100 Subject: [PATCH] add limit to database entries --- packages/unleash-api/lib/db/client-metrics.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/unleash-api/lib/db/client-metrics.js b/packages/unleash-api/lib/db/client-metrics.js index c1781673f2..9efd26d9f5 100644 --- a/packages/unleash-api/lib/db/client-metrics.js +++ b/packages/unleash-api/lib/db/client-metrics.js @@ -14,6 +14,7 @@ module.exports = function (db) { return db .select(METRICS_COLUMNS) .from(TABLE) + .limit(2000) .whereRaw('created_at > now() - interval \'7 day\'') .orderBy('created_at', 'asc') .map(mapRow); @@ -24,6 +25,7 @@ module.exports = function (db) { return db .select(METRICS_COLUMNS) .from(TABLE) + .limit(1000) .where('id', '>', lastKnownId) .orderBy('created_at', 'asc') .map(mapRow);