Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/faster-schedule-validation-lookup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Creating or updating a schedule, and deploying a project with declarative schedules, is faster in long-lived projects with many deploys.
Comment thread
ericallam marked this conversation as resolved.
3 changes: 3 additions & 0 deletions apps/webapp/app/v3/services/checkSchedule.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class CheckScheduleService extends BaseService {
slug: schedule.taskIdentifier,
projectId: projectId,
},
select: {
triggerSource: true,
},
orderBy: {
createdAt: "desc",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY IF NOT EXISTS "BackgroundWorkerTask_projectId_slug_createdAt_idx" ON "public"."BackgroundWorkerTask"("projectId", "slug", "createdAt");
1 change: 1 addition & 0 deletions internal-packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ model BackgroundWorkerTask {
@@unique([workerId, slug])
// Quick lookup of task identifiers
@@index([projectId, slug])
@@index([projectId, slug, createdAt])
@@index([runtimeEnvironmentId, projectId])
@@index([runtimeEnvironmentId, slug, triggerSource])
}
Expand Down
Loading