Skip to content

✨ feat(task): auto-ensure qstash schedule for task system#14771

Merged
arvinxx merged 3 commits into
lobehub:canaryfrom
hezhijie0327:feat/task-qstash-bootstrap
Jun 4, 2026
Merged

✨ feat(task): auto-ensure qstash schedule for task system#14771
arvinxx merged 3 commits into
lobehub:canaryfrom
hezhijie0327:feat/task-qstash-bootstrap

Conversation

@hezhijie0327

@hezhijie0327 hezhijie0327 commented May 13, 2026

Copy link
Copy Markdown
Contributor

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

  1. 自动为 Task System 创建 QStash Schedule (首次初始化 / QStash Local Server)
curl -X POST '${QSTASH_URL}/v2/schedules/${APP_URL}/api/workflows/task/schedule-dispatch' \
    -H 'Authorization: Bearer ${QSTASH_TOKEN}' \
    -H 'Content-Type: application/json' \
    -H 'Upstash-Method: POST' \
    -H 'Upstash-Cron: */10 * * * *' \
    -H 'Upstash-Schedule-Id: lobe-task-schedule-dispatch'
    -d '{}'
image

Note:

  1. QStash Local 服务器没有记录持久化,如果 QStash 服务重启需要重启 Lobe 进程重新创建

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

Before After
... ...

📝 Additional Information

@vercel

vercel Bot commented May 13, 2026

Copy link
Copy Markdown

@hezhijie0327 is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. feature:schedule-task Schedule task labels May 13, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@lobehubbot

Copy link
Copy Markdown
Member

@ONLY-yours - This PR adds auto-ensuring of QStash schedules for the task system (feature:schedule-task). Please take a look.

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.95%. Comparing base (4b6b341) to head (219fca3).
⚠️ Report is 59 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #14771      +/-   ##
==========================================
+ Coverage   65.86%   65.95%   +0.08%     
==========================================
  Files        2944     2962      +18     
  Lines      257718   261944    +4226     
  Branches    26006    31934    +5928     
==========================================
+ Hits       169756   172770    +3014     
- Misses      87805    89014    +1209     
- Partials      157      160       +3     
Flag Coverage Δ
app 60.71% <ø> (+0.06%) ⬆️
database 91.96% <ø> (+0.09%) ⬆️
packages/agent-runtime 80.48% <ø> (-0.01%) ⬇️
packages/builtin-tool-lobe-agent 18.33% <ø> (-0.45%) ⬇️
packages/context-engine 84.17% <ø> (+0.18%) ⬆️
packages/conversation-flow 91.28% <ø> (-1.16%) ⬇️
packages/file-loaders 87.60% <ø> (ø)
packages/memory-user-memory 75.01% <ø> (+0.27%) ⬆️
packages/model-bank 99.94% <ø> (ø)
packages/model-runtime 83.93% <ø> (+0.24%) ⬆️
packages/prompts 70.39% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/types 13.04% <ø> (+7.60%) ⬆️
packages/utils 87.98% <ø> (-0.04%) ⬇️
packages/web-crawler 87.74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 67.28% <ø> (+0.38%) ⬆️
Services 53.78% <ø> (+<0.01%) ⬆️
Server 71.82% <ø> (+0.19%) ⬆️
Libs 56.16% <ø> (ø)
Utils 82.65% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hezhijie0327 hezhijie0327 force-pushed the feat/task-qstash-bootstrap branch from 3366aaf to 03f66d3 Compare May 13, 2026 15:33
@arvinxx

arvinxx commented May 14, 2026

Copy link
Copy Markdown
Member

If it has already been created, will it be created again (duplicated)? It shouldn't be set up as a default creation; instead, the documentation should prompt users to create it manually. Or alternatively, execute this before Docker starts.


This comment was translated by Claude.

Original Content

已经创建过的话是否会重复创建?不应该做成默认创建,而是应该在文档中提示去手动创建。或者在 docker 启动前执行这个事情。

@hezhijie0327

Copy link
Copy Markdown
Contributor Author

不会重复创建,Schedule ID是固定的

对于 Qstash Local 版本的话,重启会清空所有数据,启动时执行的话我去看看

chore: cleanup code

chore: cleanup code

chore: cleanup code
@hezhijie0327 hezhijie0327 force-pushed the feat/task-qstash-bootstrap branch from 03f66d3 to 631f5f6 Compare May 16, 2026 12:50
chore: migrate qstash init workflow to startServer
@hezhijie0327 hezhijie0327 force-pushed the feat/task-qstash-bootstrap branch from 631f5f6 to cb6f934 Compare May 16, 2026 12:52
fix: set default QSTASH_URL to eu region, same as SDK
@hezhijie0327 hezhijie0327 force-pushed the feat/task-qstash-bootstrap branch from 9da5ca9 to 219fca3 Compare May 16, 2026 13:05
@hezhijie0327

hezhijie0327 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

@arvinxx Moved it to startServer.js

image

This comment was translated by Claude.

Original Content

@arvinxx 挪到 startServer.js 中去了

image

@pfangit

pfangit commented Jun 4, 2026

Copy link
Copy Markdown

I found a project that simulates QStash. I tried it and it seems to support local deployment: downstash


This comment was translated by Claude.

Original Content

我发现一个模拟 qstash的服务项目 试了一下好像可以进行本地部署使用 downstash

@arvinxx arvinxx merged commit 25635dd into lobehub:canary Jun 4, 2026
21 of 22 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @hezhijie0327 ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

@hezhijie0327 hezhijie0327 deleted the feat/task-qstash-bootstrap branch June 4, 2026 22:35
This was referenced Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:schedule-task Schedule task size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants