# HG changeset patch # User Kim Alvefur # Date 1606068702 -3600 # Node ID 91b951fb3018358e45f0c4e29320a7483fcaa817 # Parent 9623b99bb8d25362333d959e9ee052b08c1d9fa9 mod_http_oauth2: Periodically trim unused authorization codes diff -r 9623b99bb8d2 -r 91b951fb3018 mod_http_oauth2/mod_http_oauth2.lua --- a/mod_http_oauth2/mod_http_oauth2.lua Sun Nov 22 18:49:31 2020 +0100 +++ b/mod_http_oauth2/mod_http_oauth2.lua Sun Nov 22 19:11:42 2020 +0100 @@ -22,6 +22,15 @@ return code_expired(code) end); +module:add_timer(900, function() + local k, code = codes:tail(); + while code and code_expired(code) do + codes:set(k, nil); + k, code = codes:tail(); + end + return 900; +end) + local function oauth_error(err_name, err_desc) return errors.new({ type = "modify";