Mercurial > prosody-modules
diff mod_http_oauth2/mod_http_oauth2.lua @ 4272:91b951fb3018
mod_http_oauth2: Periodically trim unused authorization codes
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 22 Nov 2020 19:11:42 +0100 |
parents | 9623b99bb8d2 |
children | ec33b3b1136c |
line wrap: on
line diff
--- 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";