Skip to content

Commit 1282b77

Browse files
author
Miya
committed
fix: preserve active alarms and correct SDK docs
1 parent e9841b6 commit 1282b77

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/server/src/routes/schedules.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,10 @@ export function createSchedulesRouter(scheduler: Scheduler) {
327327

328328
// Update alarm if next_run_at changed or status toggled.
329329
if (updates.next_run_at !== undefined || data.status !== undefined) {
330-
if (updates.next_run_at) {
331-
scheduler.setAlarm(c.req.param("id"), updates.next_run_at as string);
330+
const effectiveNextRunAt =
331+
updates.next_run_at !== undefined ? updates.next_run_at : existing.next_run_at;
332+
if (effectiveNextRunAt) {
333+
scheduler.setAlarm(c.req.param("id"), effectiveNextRunAt as string);
332334
} else {
333335
scheduler.cancelAlarm(c.req.param("id"));
334336
}

skill.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Save the `api_key` from the response (starts with `ac_`). It cannot be retrieved
2323

2424
**One-time schedule (webhook delivery):**
2525
```typescript
26-
import { RelayCron } from "@relaycron/sdk";
26+
import { AgentCron } from "@relaycron/sdk";
2727

28-
const cron = new RelayCron({ apiKey: "ac_..." });
28+
const cron = new AgentCron({ apiKey: "ac_..." });
2929

3030
await cron.createSchedule({
3131
name: "deploy-reminder",
@@ -66,7 +66,7 @@ await cron.createSchedule({
6666
Instead of setting up a webhook endpoint, connect via WebSocket to receive payloads in real-time:
6767

6868
```typescript
69-
const cron = new RelayCron({ apiKey: "ac_..." });
69+
const cron = new AgentCron({ apiKey: "ac_..." });
7070

7171
// Create a schedule with websocket transport
7272
await cron.createSchedule({
@@ -208,7 +208,7 @@ Standard 5-field cron: `minute hour day-of-month month day-of-week`
208208
### SDK Methods
209209

210210
```typescript
211-
const cron = new RelayCron({ apiKey: "ac_..." });
211+
const cron = new AgentCron({ apiKey: "ac_..." });
212212

213213
// Schedules
214214
await cron.createSchedule({...});

0 commit comments

Comments
 (0)