diff --git a/index.js b/index.js index 74d8944..a60cad2 100644 --- a/index.js +++ b/index.js @@ -511,7 +511,10 @@ exports.rate_conn_enforce = async function (next, connection) { let connections_in_ttl_period = 0 for (const ts of Object.keys(tstamps)) { - if (parseInt(ts, 10) < periodStartTs) continue // older than ttl + if (parseInt(ts, 10) < periodStartTs) { // older than ttl + this.db.hDel(`rate_conn:${key}`, ts); + continue + } connections_in_ttl_period = connections_in_ttl_period + parseInt(tstamps[ts], 10) }