---
id: gh-convex-crons
name: "convex-crons"
url: https://skills.yangsir.net/skill/gh-convex-crons
author: convex
domain: ai-backend-engineering
tags: ["crons", "convex", "scheduled-jobs", "backend", "serverless"]
install_count: 46400
rating: 4.70 (120 reviews)
github: https://github.com/convex/agent-skills/tree/main/skills/convex-crons
---

# convex-crons

> 为 Convex 应用添加周期性定时任务(crons),在 convex/crons.ts 中定义调度内部函数的作业。此技能强制使用内部函数、合理的执行间隔与幂等处理逻辑,并提醒用订阅推送替代高频轮询,让后台作业一次配置正确、可安全重跑。

**Stats**: 46,400 installs · 4.7/5 (120 reviews)

## Before / After 对比

### 从反复试错到一次配置正确的定时任务

**Before**:

开发者手动翻查文档、凭感觉猜执行间隔,还把定时任务挂在公开接口上,往往部署后才发现任务根本没跑、被重复触发,或者频率过高持续拖慢数据库。

**After**:

此技能给出定时任务配置文件的标准结构与内部函数调度规则,并强调幂等处理与合理间隔,作业一次配置成功、可安全重跑,后台调度长期稳定。

| Metric | Before | After | Change |
|---|---|---|---|
| 定时任务配置耗时 | 90分钟 | 10分钟 | -89% |
| 重复执行导致的数据异常率 | 25% | 3% | -88% |

## Readme

<!-- GENERATED from convex-agents content/capabilities/crons.json — do not edit by hand. -->

# Add scheduled jobs (crons)

Define recurring jobs in convex/crons.ts targeting internal functions, with sane intervals and idempotent handlers.

## Workflow

1. Create convex/crons.ts with cronJobs().
2. Schedule internal functions (never public api.*) at the right interval.
3. Make handlers idempotent (safe to re-run); keep each run small.
4. Verify the job appears in the dashboard schedule.

## Rules

- Schedule internal.* functions, never api.*.
- Keep cron handlers small + idempotent.
- Don't poll tight intervals for things a subscription can push.


---
*Source: https://skills.yangsir.net/skill/gh-convex-crons*
*Markdown mirror: https://skills.yangsir.net/api/skill/gh-convex-crons/markdown*