changeset 3200:d070a751b6ed

mod_s2s_auth_posh: Cache tweak
author Kim Alvefur <zash@zash.se>
date Thu, 21 Dec 2017 03:04:51 +0100
parents cb7c24305ed2
children 73be17be7d84
files mod_s2s_auth_posh/mod_s2s_auth_posh.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
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;