From eaf18e0297d49cd5b862b0317573332b1cd31954 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Fri, 23 Dec 2022 20:14:01 +0000 Subject: [PATCH 1/5] Periodically add to redis --- creator-node/src/blacklistManager.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/creator-node/src/blacklistManager.js b/creator-node/src/blacklistManager.js index 4dd0d59bca0..15a84577505 100644 --- a/creator-node/src/blacklistManager.js +++ b/creator-node/src/blacklistManager.js @@ -41,6 +41,20 @@ class BlacklistManager { userIdsToBlacklist, segmentsToBlacklist }) + + // add items to redis periodically in case redis restarts + setInterval(async function () { + const { + trackIdsToBlacklist, + userIdsToBlacklist, + segmentsToBlacklist + } = await this._getDataToBlacklist() + await this._fetchCIDsAndAddToRedis({ + trackIdsToBlacklist, + userIdsToBlacklist, + segmentsToBlacklist + }) + }, 1000 * 60 * 60 * 6 /* six hours */) } this.initialized = true From 841b9ec7bb36edae7bf23585f12d32b8c3403f77 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Fri, 23 Dec 2022 20:29:46 +0000 Subject: [PATCH 2/5] Add log --- creator-node/src/blacklistManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/creator-node/src/blacklistManager.js b/creator-node/src/blacklistManager.js index 15a84577505..c14653bc35f 100644 --- a/creator-node/src/blacklistManager.js +++ b/creator-node/src/blacklistManager.js @@ -54,6 +54,7 @@ class BlacklistManager { userIdsToBlacklist, segmentsToBlacklist }) + this._log(`Re-added to redis`) }, 1000 * 60 * 60 * 6 /* six hours */) } From 7034ffb78dc98282ae3d0d313e9fff97b92ded12 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Sat, 24 Dec 2022 13:45:12 +0000 Subject: [PATCH 3/5] Change to 1 hour for testing --- creator-node/src/blacklistManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creator-node/src/blacklistManager.js b/creator-node/src/blacklistManager.js index c14653bc35f..40cc7b985ec 100644 --- a/creator-node/src/blacklistManager.js +++ b/creator-node/src/blacklistManager.js @@ -55,7 +55,7 @@ class BlacklistManager { segmentsToBlacklist }) this._log(`Re-added to redis`) - }, 1000 * 60 * 60 * 6 /* six hours */) + }, 1000 * 60 * 60 * 1 /* one hour */) // TODO - confirm timing } this.initialized = true From 8e720d16cfcf5a73bcf7c222b95b6656c4f11e7f Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Sun, 25 Dec 2022 23:56:21 +0000 Subject: [PATCH 4/5] Convert to arrow fn --- creator-node/src/blacklistManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creator-node/src/blacklistManager.js b/creator-node/src/blacklistManager.js index 40cc7b985ec..24c5c4db8d6 100644 --- a/creator-node/src/blacklistManager.js +++ b/creator-node/src/blacklistManager.js @@ -43,7 +43,7 @@ class BlacklistManager { }) // add items to redis periodically in case redis restarts - setInterval(async function () { + setInterval(async () => { const { trackIdsToBlacklist, userIdsToBlacklist, From c74b67daf0a643cb3d7a35a531def5332d3662c8 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Tue, 27 Dec 2022 17:27:41 +0000 Subject: [PATCH 5/5] Adjust interval --- creator-node/src/blacklistManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creator-node/src/blacklistManager.js b/creator-node/src/blacklistManager.js index 24c5c4db8d6..b248839ac0a 100644 --- a/creator-node/src/blacklistManager.js +++ b/creator-node/src/blacklistManager.js @@ -55,7 +55,7 @@ class BlacklistManager { segmentsToBlacklist }) this._log(`Re-added to redis`) - }, 1000 * 60 * 60 * 1 /* one hour */) // TODO - confirm timing + }, 1000 * 60 * 60 * 2 /* two hours */) } this.initialized = true