Skip to content

Commit

Permalink
Periodically add blacklisted items to redis (#4532)
Browse files Browse the repository at this point in the history
* Periodically add to redis

* Add log

* Change to 1 hour for testing

* Convert to arrow fn

* Adjust interval
  • Loading branch information
dmanjunath authored Dec 27, 2022
1 parent 6f7638d commit 499a9a4
Showing 1 changed file with 15 additions and 0 deletions.
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 * 2 /* two hours */)
}

this.initialized = true
Expand Down

0 comments on commit 499a9a4

Please sign in to comment.