-
-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a db index to make the schedule list page faster
There was a slow query to get the latest run for a list of schedules
- Loading branch information
1 parent
e422fb5
commit f099668
Showing
3 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.../prisma/migrations/20241106112827_task_run_add_schedule_id_created_at_index/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- CreateIndex | ||
CREATE INDEX CONCURRENTLY IF NOT EXISTS "TaskRun_scheduleId_createdAt_idx" ON "TaskRun"("scheduleId", "createdAt" DESC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { schedules } from "@trigger.dev/sdk/v3"; | ||
|
||
export const simpleSchedule = schedules.task({ | ||
id: "simple-schedule", | ||
cron: "0 0 * * *", | ||
run: async (payload, { ctx }) => { | ||
return { | ||
message: "Hello, world!", | ||
}; | ||
}, | ||
}); |