Add safety delay for VAPID header expirity

This commit is contained in:
sim
2025-10-31 09:32:19 +01:00
parent 49a7e26a2f
commit 28aa2da55c

View File

@@ -68,7 +68,8 @@ getVapidHeader vapidK cache uriAuthority = do
now <- systemSeconds <$> getSystemTime
case h of
Nothing -> newCacheEntry now
Just entry -> if expire entry > now then pure $ vapidHeader entry
-- if it expires in 1 min, then we renew - for safety
Just entry -> if expire entry > now + 60 then pure $ vapidHeader entry
else newCacheEntry now
where
newCacheEntry :: Int64 -> IO B.ByteString