🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(task): auto-ensure qstash schedule for task system (#14771)
Zhijie He25635ddb385a
diff --git a/scripts/serverLauncher/startServer.js b/scripts/serverLauncher/startServer.jsindex a3604451119..dd80221978a 100644--- a/scripts/serverLauncher/startServer.js+++ b/scripts/serverLauncher/startServer.js@@ -163,6 +163,47 @@ const startGateway = async () => {console.error('❌ Gateway: Failed to start after retries.');};+// Function to create QStash schedule for dispatching workflow tasks every 10 minutes+const createQstashSchedule = async () => {+ const QSTASH_URL = process.env.QSTASH_URL || 'https://qstash-eu-central-1.upstash.io';++ const QSTASH_TOKEN = process.env.QSTASH_TOKEN;+ if (!QSTASH_TOKEN) {+ console.warn('⚠️ QStash: QSTASH_TOKEN not set. Skipping schedule creation.');+ return;+ }++ const APP_URL = process.env.APP_URL;+ if (!APP_URL) {+ console.warn('⚠️ QStash: APP_URL not set. Skipping schedule creation.');+ return;+ }++ const url = `${QSTASH_URL}/v2/schedules/${APP_URL}/api/workflows/task/schedule-dispatch`;++ try {+ const res = await fetch(url, {+ method: 'POST',+ headers: {+ 'Authorization': `Bearer ${QSTASH_TOKEN}`,+ 'Content-Type': 'application/json',+ 'Upstash-Method': 'POST',+ 'Upstash-Cron': '*/10 * * * *',+ 'Upstash-Schedule-Id': 'lobe-task-schedule-dispatch',+ },+ body: JSON.stringify({}),+ });++ if (res.ok) {+ console.log('✅ QStash: Schedule created successfully.');+ } else {+ console.error(`❌ QStash: Failed to create schedule. Status ${res.status}`);+ }+ } catch (err) {+ console.error('❌ QStash: Error creating schedule:', err);+ }+};+// Main function to run the server with optional proxyconst runServer = async () => {const PROXY_URL = process.env.PROXY_URL || ''; // Default empty string to avoid undefined errors@@ -204,6 +245,9 @@ const runServer = async () => {// Start gateway in background after server is readystartGateway();+ // Create QStash schedule for workflow task dispatching+ createQstashSchedule();+// Run the server in either database or non-database modeawait runServer();})();