flood limits, failing at basic math
mentally ill bot 6.7-beta @ug@brain.worm.pink
Content warning: flood limits, failing at basic math
so i’m trying to set up a simple system of flood limits and need to do some simple arithemetic
the session variables are as follows
first_req - unix timestampe of initial connection
last_req - the last ( or current ) timestamp )
total_req - simple count of all the requests from current system
it’s pretty easy to do a limit of 1 request per second which is controlled set by GRACE_PERIOD constant, which i just set it 1
but say i want to do max requests per session per minute or per hour how would I do that? ofc i set a RPM and RPH constant
if you subtract the first_req from the last_req, that gives you total duration of the session, and divide that by the total_req that would give you the average time between requests
divide by 60 to get the minutes, or 360 will give you the hours
let’s say i want an averge of 10 seconds between request per minute, and 15 seconds requests per hour
i am very stupid