[Fix] Internal cron scheduler blocking view responses

Internal cron is now triggered by an axios request from the frontend so it can truly run in a separate request. Fixes #167
This commit is contained in:
2025-12-07 12:55:33 +01:00
parent 25034ee2f3
commit 6b688f72e0
8 changed files with 108 additions and 119 deletions
+20 -4
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Head } from '@inertiajs/vue3'
import { Head, usePage } from '@inertiajs/vue3'
import AppSidebar from '@/components/AppSidebar.vue';
import { onMounted } from 'vue';
import 'vue-sonner/style.css'
@@ -7,22 +7,38 @@ import { Toaster } from 'vue-sonner'
import { Info, CircleAlert, CircleCheck, LoaderCircle, Ban } from "lucide-vue-next"
import { Button } from '@/components/ui/crm-button'
import { SidebarProvider } from '@/components/ui/sidebar';
import { usePage } from '@inertiajs/vue3';
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'
import { alertStore } from '@/stores/alertStore';
import axios from 'axios';
const isOpen = usePage().props.sidebarOpen;
const alert = alertStore()
const props = defineProps<{
title: string;
title: string
}>();
const isOpen = usePage().props.sidebarOpen;
const cron = usePage().props.cron
onMounted(() => {
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
document.body.classList.add('is-mac')
}
if (cron) {
triggerWebcron()
setInterval(triggerWebcron, 30000)
}
})
const triggerWebcron = async function () {
await axios.get('/webcron')
.catch(function (response) {
if (response.status >= 400) {
console.error(response.message)
}
})
}
</script>
<template>
+24
View File
@@ -2,11 +2,35 @@
// import AuthLayout from '@/layouts/auth/AuthSimpleLayout.vue';
// import AuthLayout from '@/layouts/auth/AuthCardLayout.vue';
import AuthLayout from '@/layouts/auth/AuthSplitLayout.vue';
import { onMounted } from 'vue';
import { usePage } from '@inertiajs/vue3'
import axios from 'axios';
defineProps<{
title?: string;
description?: string;
}>();
const cron = usePage().props.cron
onMounted(() => {
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
document.body.classList.add('is-mac')
}
if (cron) {
triggerWebcron()
}
})
const triggerWebcron = async function () {
await axios.get('/webcron')
.catch(function (response) {
if (response.status >= 400) {
console.error(response)
}
})
}
</script>
<template>