From 04c6716171428ff8f3839399f59312a9c1299253 Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 12 Nov 2021 14:48:17 +0400 Subject: [PATCH] Moved url cache loading logic behind the flag refs https://github.com/TryGhost/Toolbox/issues/125 - The url loader is not fully working and is in very experimental mode. The aim is to ship this version to allow other team members to play with the feature in limited use-cases like testing evnironment --- core/server/services/url/UrlService.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/server/services/url/UrlService.js b/core/server/services/url/UrlService.js index 71c451eb32..7bd99a7135 100644 --- a/core/server/services/url/UrlService.js +++ b/core/server/services/url/UrlService.js @@ -3,6 +3,7 @@ const _debug = require('@tryghost/debug')._base; const debug = _debug('ghost:services:url:service'); const _ = require('lodash'); const errors = require('@tryghost/errors'); +const labs = require('../../../shared/labs'); const UrlGenerator = require('./UrlGenerator'); const Queue = require('./Queue'); const Urls = require('./Urls'); @@ -313,15 +314,15 @@ class UrlService { } async persistUrls() { - if (!this.urlCachePath) { + if (!labs.isSet('urlCache') || !this.urlCachePath) { return null; } - return fs.writeFileSync(this.urlCachePath, JSON.stringify(this.urls.urls, null, 4)); + return fs.writeFile(this.urlCachePath, JSON.stringify(this.urls.urls, null, 4)); } async fetchUrls() { - if (!this.urlCachePath) { + if (!labs.isSet('urlCache') || !this.urlCachePath) { return null; }