# HG changeset patch # User Kim Alvefur # Date 1682157592 -7200 # Node ID 39d59d857bfb5bdb85eca2e95e7895106468d5ac # Parent 14b6397cd6dee2c938a940dc63ffbf974c17841d mod_http_oauth2: Use new mod_cron API for periodic cleanup Less frequent but this isn't that important after all since, as the comment states, expired codes are not usable anyway. They're also not that large so memory usage probably doesn't matter. diff -r 14b6397cd6de -r 39d59d857bfb mod_http_oauth2/mod_http_oauth2.lua --- a/mod_http_oauth2/mod_http_oauth2.lua Tue Apr 18 21:48:31 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Sat Apr 22 11:59:52 2023 +0200 @@ -121,13 +121,12 @@ -- 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:add_timer(900, function() +module:hourly("Clear expired authorization codes", function() local k, code = codes:tail(); while code and code_expired(code) do codes:set(k, nil); k, code = codes:tail(); end - return code and code_expires_in(code) + 1 or 900; end) local function get_issuer()