Throttle platform SSO session checks to cut per-request auth latency.
Deploy Ladill Frontdesk / deploy (push) Successful in 47s

Verify auth.ladill.com at most once every 90s; recommend Redis for session/cache in .env.example.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-30 16:49:21 +00:00
co-authored by Cursor
parent 34e2163da1
commit 0351771b00
3 changed files with 43 additions and 2 deletions
@@ -0,0 +1,21 @@
@if (auth()->check())
@php
$authPing = 'https://'.config('app.auth_domain').'/sso/ping';
$platformSignedOutUrl = route('sso.platform-signed-out', ['redirect' => url()->current()]);
@endphp
<script>
(function () {
const pingUrl = @js($authPing);
const signedOutUrl = @js($platformSignedOutUrl);
const ping = () => fetch(pingUrl, { credentials: 'include' })
.then((response) => {
if (response.status === 401) {
window.location.href = signedOutUrl;
}
})
.catch(() => {});
ping();
setInterval(ping, 5 * 60 * 1000);
})();
</script>
@endif