mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-25 10:06:28 +00:00
some comments
This commit is contained in:
@@ -182,7 +182,7 @@ impl ConnectionPool {
|
||||
pub fn is_banned(&self, address: &Address, shard: usize) -> bool {
|
||||
let mut guard = self.banlist.lock().unwrap();
|
||||
|
||||
// Everything is banned, nothig is banned
|
||||
// Everything is banned = nothing is banned.
|
||||
if guard[shard].len() == self.databases[shard].len() {
|
||||
guard[shard].clear();
|
||||
drop(guard);
|
||||
@@ -194,8 +194,8 @@ impl ConnectionPool {
|
||||
match guard[shard].get(address) {
|
||||
Some(timestamp) => {
|
||||
let now = chrono::offset::Utc::now().naive_utc();
|
||||
// Ban expired.
|
||||
if now.timestamp() - timestamp.timestamp() > self.ban_time {
|
||||
// 1 minute
|
||||
guard[shard].remove(address);
|
||||
false
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user