From edd0e26a78c3f3bc2dd44116dff08268b642bfbd Mon Sep 17 00:00:00 2001 From: Naz Date: Sat, 10 Apr 2021 00:05:43 +1200 Subject: [PATCH] Fixed limits realoding during soft Ghost restart refs https://github.com/TryGhost/Team/issues/599 - This is a precursor change to tests which verify the hostSettings limits are working correctly - Bumped limits-service version which allows for multiple calls of loadLimits on the same service instance --- core/server/services/limits.js | 4 ---- package.json | 2 +- test/utils/index.js | 4 ++++ yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/server/services/limits.js b/core/server/services/limits.js index 6bfe3d8427..f669213719 100644 --- a/core/server/services/limits.js +++ b/core/server/services/limits.js @@ -7,10 +7,6 @@ let limitService = new LimitService(); const initFn = () => { let helpLink; - if (!config.get('hostSettings') || !config.get('hostSettings:limits')) { - return; - } - if (config.get('hostSettings:billing:enabled') && config.get('hostSettings:billing:enabled') === true && config.get('hostSettings:billing:url')) { helpLink = config.get('hostSettings:billing:url'); } else { diff --git a/package.json b/package.json index 695436f641..ffb6283856 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@tryghost/kg-default-cards": "4.0.2", "@tryghost/kg-markdown-html-renderer": "4.0.1", "@tryghost/kg-mobiledoc-html-renderer": "4.0.0", - "@tryghost/limit-service": "0.4.0", + "@tryghost/limit-service": "0.4.1", "@tryghost/magic-link": "1.0.0", "@tryghost/members-api": "1.1.1", "@tryghost/members-csv": "1.0.0", diff --git a/test/utils/index.js b/test/utils/index.js index ffca924d71..e60a974b36 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -24,6 +24,7 @@ const frontendSettingsService = require('../../core/frontend/services/settings') const settingsCache = require('../../core/server/services/settings/cache'); const web = require('../../core/server/web'); const themes = require('../../core/frontend/services/themes'); +const limits = require('../../core/server/services/limits'); // Other Test Utilities const APIUtils = require('./api'); @@ -205,6 +206,9 @@ const restartModeGhostStart = async () => { // Trigger themes to load again themes.loadInactiveThemes(); + + // Reload limits service + limits.init(); }; const bootGhost = async () => { diff --git a/yarn.lock b/yarn.lock index 5fb8c5292c..cb34e6c6b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -559,10 +559,10 @@ dependencies: "@tryghost/kg-clean-basic-html" "^1.0.13" -"@tryghost/limit-service@0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@tryghost/limit-service/-/limit-service-0.4.0.tgz#a681eb866171a6966162db87ae0d18ccb1fbb965" - integrity sha512-DVWYiKgvXzWqi+L2jJPhTQLogiRZUJw+bX9XMmLg202rnNAn8A9eYIAmWu5TbY4Gp0+6gz6IZFdIIocGDtA8Aw== +"@tryghost/limit-service@0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@tryghost/limit-service/-/limit-service-0.4.1.tgz#c827e8a334854766f073520ae5dab12e132e0945" + integrity sha512-MYcW+s4+OfA9C/tI7e0ZKhxUk02tVhkcrBc/7p+BgiJnS+LdcgrV21xRqH/UhERotgOLcFRTHPt6bkqW1Lnhwg== dependencies: lodash "^4.17.21"