From ae5dd8ad308998ad146bdf14a183ed2557437291 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 18 Nov 2021 20:27:02 +0400 Subject: [PATCH] Fixed event listener pileup refs https://github.com/TryGhost/Toolbox/issues/135 - When instantiating new Urls/Resources object in the UrlService's init on every test suite start it was loosing track of past events (softReset wasn't doing the cleanup properly). Not initializing new classes "fixes" the problem partially, by not loosing track of those event listeners. The real fix should be proper even listener cleanup on every soft reset! --- core/server/services/url/UrlService.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/server/services/url/UrlService.js b/core/server/services/url/UrlService.js index 1e082ef157..400d9816a9 100644 --- a/core/server/services/url/UrlService.js +++ b/core/server/services/url/UrlService.js @@ -332,13 +332,8 @@ class UrlService { } if (persistedUrls && persistedResources) { - this.urls = new Urls({ - urls: persistedUrls - }); - this.resources = new Resources({ - queue: this.queue, - resources: persistedResources - }); + this.urls.urls = persistedUrls; + this.resources.data = persistedResources; this.resources.initResourceConfig(); this.resources.initEvenListeners();