From 13d30827aabc12a137b1ddc901c7dd46bb4b4d05 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Tue, 14 Aug 2018 21:53:00 -0600 Subject: [PATCH] Allow how many to keep in DB by config 'retainCount' --- core/onelinerz.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/onelinerz.js b/core/onelinerz.js index 2d902a8e..19b9ce44 100644 --- a/core/onelinerz.js +++ b/core/onelinerz.js @@ -287,14 +287,15 @@ exports.getModule = class OnelinerzModule extends MenuModule { ); }, function removeOld(callback) { - // keep 25 max most recent items - remove the older ones + // keep 25 max most recent items by default - remove the older ones + const retainCount = self.menuConfig.config.retainCount || 25; self.db.run( `DELETE FROM onelinerz WHERE id IN ( SELECT id FROM onelinerz ORDER BY id DESC - LIMIT -1 OFFSET 25 + LIMIT -1 OFFSET ${retainCount} );`, callback );