-
Notifications
You must be signed in to change notification settings - Fork 9
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
SHARD-1147: Improve Blacklisting Consistency and Optimize Check Intervals #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes looks good..
a94e33c
…sync unbans, ensure consistency, and enhance error handling.
src/utils.ts
Outdated
if (verifyData.length !== this.bannedIps.length) { | ||
if (verbose) console.log('Warning: Inconsistency detected between bannedIps and blacklist.json') | ||
// Ensure bannedIps matches the file | ||
this.bannedIps = verifyData.map((ip: string) => ({ | ||
ip, | ||
timestamp: Date.now(), | ||
})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this block needed? if this is to handle race condition, then this verification doesn't solve the issue. because verifyData.length !== this.bannedIps.length
can be true but content of both arrays can be different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the check to keep the blacklist.json
data consistent with the in-memory blacklist IP map. I've now updated it so that if there's any inconsistency, it prioritizes the in-memory map.
Linear: https://linear.app/shm/issue/SHARD-1147
Summary: