mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
dashboard: enhance mothership reachability checks
This commit is contained in:
parent
a1f046bc8b
commit
78585b25b0
@ -3,18 +3,16 @@
|
||||
</script>
|
||||
|
||||
{#if !$isMothershipReachable}
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
||||
<div class="alert alert-error max-w-2xl mx-4">
|
||||
<div class="text-center">
|
||||
<h2 class="text-xl font-bold mb-2">Connection Lost</h2>
|
||||
<p>
|
||||
The PocketHost mothership is temporarily unreachable. Your instances
|
||||
are safe and still reachable. Go to the <a
|
||||
href="https://status.pockethost.io"
|
||||
class="link font-semibold underline">status page</a
|
||||
> for more information.
|
||||
</p>
|
||||
</div>
|
||||
<div class="bg-error text-error-content p-4 rounded-none">
|
||||
<div class="text-center">
|
||||
<h2 class="text-xl font-bold mb-2">Connection Lost</h2>
|
||||
<p>
|
||||
The PocketHost mothership is temporarily unreachable. Your instances are
|
||||
safe and still reachable. Go to the <a
|
||||
href="https://status.pockethost.io"
|
||||
class="link font-semibold underline">status page</a
|
||||
> for more information.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -41,21 +41,33 @@ export const stats = writable<{
|
||||
total_flounder_subscribers: 0,
|
||||
})
|
||||
|
||||
const checkStats = () => {
|
||||
client()
|
||||
.client.send(`/api/stats`, {})
|
||||
.then((res) => {
|
||||
stats.set(res)
|
||||
isMothershipReachable.set(true)
|
||||
// setTimeout(checkStats, 1000 * 60 * 5)
|
||||
})
|
||||
.catch(() => {
|
||||
// isMothershipReachable.set(false)
|
||||
// setTimeout(checkStats, 1000)
|
||||
})
|
||||
}
|
||||
|
||||
const continuouslyCheckMothershipReachability = () => {
|
||||
setInterval(() => {
|
||||
client()
|
||||
.client.send(`/api/health`, {})
|
||||
.then((res) => {
|
||||
isMothershipReachable.set(true)
|
||||
})
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
export const init = () => {
|
||||
const { onAuthChange } = client()
|
||||
|
||||
const checkStats = () => {
|
||||
client()
|
||||
.client.send(`/api/stats`, {})
|
||||
.then((res) => {
|
||||
stats.set(res)
|
||||
setTimeout(checkStats, 1000 * 60 * 5)
|
||||
})
|
||||
.catch(() => {
|
||||
isMothershipReachable.set(false)
|
||||
setTimeout(checkStats, 1000)
|
||||
})
|
||||
}
|
||||
checkStats()
|
||||
|
||||
onAuthChange((authStoreProps) => {
|
||||
@ -121,15 +133,4 @@ export const init = () => {
|
||||
}
|
||||
tryInstanceSubscribe()
|
||||
})
|
||||
|
||||
setInterval(() => {
|
||||
client()
|
||||
.client.send(`/api/health`, {})
|
||||
.then((res) => {
|
||||
isMothershipReachable.set(true)
|
||||
})
|
||||
.catch(() => {
|
||||
isMothershipReachable.set(false)
|
||||
})
|
||||
}, 5000)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user