Changeset

5354:39d59d857bfb

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.
author Kim Alvefur <zash@zash.se>
date Sat, 22 Apr 2023 11:59:52 +0200
parents 5353:14b6397cd6de
children 5355:41a418ebc60b
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()