fix: make sure to set the visitor after filtering
This commit is contained in:
parent
e553ee166b
commit
19bb57bc03
@ -48,10 +48,12 @@ const _addLastVisitor = (visitors: Map<string, Visitor>, request: Request, cooki
|
||||
visitors.forEach((visitor, id, map) => {
|
||||
if (currentTime - visitor.visits[0] > 1000 * VISITOR_EXPIRY_SECONDS)
|
||||
map.delete(id)
|
||||
else
|
||||
else {
|
||||
visitor.visits = visitor.visits.filter((since) => {
|
||||
return currentTime - since < 1000 * VISITOR_EXPIRY_SECONDS
|
||||
})
|
||||
map.set(id, visitor)
|
||||
}
|
||||
})
|
||||
// check whether the request is from a bot or not (this doesnt need to be accurate we just want to filter out honest bots)
|
||||
if (isBot(request)) { return visitors }
|
||||
|
Loading…
Reference in New Issue
Block a user