Diff

mod_s2s_auth_posh/mod_s2s_auth_posh.lua @ 3200:d070a751b6ed

mod_s2s_auth_posh: Cache tweak
author Kim Alvefur <zash@zash.se>
date Thu, 21 Dec 2017 03:04:51 +0100
parent 3199:cb7c24305ed2
child 3201:73be17be7d84
line wrap: on
line diff
--- a/mod_s2s_auth_posh/mod_s2s_auth_posh.lua	Wed Mar 15 15:49:46 2017 +0100
+++ b/mod_s2s_auth_posh/mod_s2s_auth_posh.lua	Thu Dec 21 03:04:51 2017 +0100
@@ -33,9 +33,13 @@
 	end
 
 	local cached = cache:get(target_host);
-	if cached and os.time() < cached.expires then
-		host_session.posh = { jwk = cached };
-		return false;
+	if cached then
+		if os.time() > cached.expires then
+			cache:set(target_host, nil);
+		else
+			host_session.posh = { jwk = cached };
+			return false;
+		end
 	end
 	local log = host_session.log or module._log;