From 28aa2da55c4787f05929835319b8d8d91788fbdc Mon Sep 17 00:00:00 2001 From: sim Date: Fri, 31 Oct 2025 09:32:19 +0100 Subject: [PATCH] Add safety delay for VAPID header expirity --- src/Simplex/Messaging/Notifications/Server/Push/WebPush.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Simplex/Messaging/Notifications/Server/Push/WebPush.hs b/src/Simplex/Messaging/Notifications/Server/Push/WebPush.hs index 704726380..7794deb47 100644 --- a/src/Simplex/Messaging/Notifications/Server/Push/WebPush.hs +++ b/src/Simplex/Messaging/Notifications/Server/Push/WebPush.hs @@ -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