Reuse epoch-verified record snapshots and avoid empty push payloads

This commit is contained in:
GPT on behalf of DHH
2026-10-08 12:26:50 +02:00
parent 74381e8b58
commit bbee420097
9 changed files with 159 additions and 21 deletions
@@ -1,7 +1,12 @@
module Authentication::SessionLookup
def find_session_by_cookie
if token = cookies.signed[:session_token]
Session.find_by(token: token)
version = @response_cache_version if @response_cache_version && (request.get? || request.head?)
session, user = RecordCache.fetch([ "session", Digest::SHA256.hexdigest(token.to_s) ], version) do
session = Session.find_by(token: token)
[ session, session&.user ]
end
session&.tap { |record| record.user = user }
end
end
end