rate limit cache cleaner

This commit is contained in:
Skillz
2020-03-14 13:35:31 -04:00
parent 45d49ef441
commit 063e796869

View File

@@ -10,6 +10,14 @@ export interface Rate_Limited_Path {
reset_timestamp: number
}
setInterval(() => {
const now = Date.now()
ratelimited_paths.forEach((value, key) => {
if (value.reset_timestamp > now) return
ratelimited_paths.delete(key)
})
}, 1000)
export const Request_Manager = {
// Something off about using run_method with get breaks when using fetch
get: async (url: string, body?: unknown) => {