Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodically add blacklisted items to redis #4532

Merged
merged 6 commits into from
Dec 27, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions creator-node/src/blacklistManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ class BlacklistManager {
userIdsToBlacklist,
segmentsToBlacklist
})

// add items to redis periodically in case redis restarts
setInterval(async () => {
const {
trackIdsToBlacklist,
userIdsToBlacklist,
segmentsToBlacklist
} = await this._getDataToBlacklist()
await this._fetchCIDsAndAddToRedis({
trackIdsToBlacklist,
userIdsToBlacklist,
segmentsToBlacklist
})
this._log(`Re-added to redis`)
}, 1000 * 60 * 60 * 1 /* one hour */) // TODO - confirm timing
}

this.initialized = true
Expand Down