Mercurial > prosody-modules
diff mod_http_oauth2/mod_http_oauth2.lua @ 5618:869c01d91aea
mod_http_oauth2: Clean cache less frequently
Seems unlikely that enough unused and expired codes accumulate to
warrant an hourly job.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 24 Jul 2023 01:26:41 +0200 |
parents | d8622797e315 |
children | 81042c2a235a |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Mon Jul 24 01:30:14 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Mon Jul 24 01:26:41 2023 +0200 @@ -216,9 +216,8 @@ return code_expired(code) end); --- Periodically clear out unredeemed codes. Does not need to be exact, expired --- codes are rejected if tried. Mostly just to keep memory usage in check. -module:hourly("Clear expired authorization codes", function() +-- Clear out unredeemed codes so they don't linger in memory. +module:daily("Clear expired authorization codes", function() local k, code = codes:tail(); while code and code_expired(code) do codes:set(k, nil);