Skip to content

Commit 5504e7f

Browse files
authored
Fix schedule limit counting (#2899)
Fix schedule counting - Inactive TaskSchedule not counted - Inactive environments (archived preview branches) not counted Clarified per-project limits descriptions.
1 parent 7a7c4b1 commit 5504e7f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

apps/webapp/app/presenters/v3/LimitsPresenter.server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class LimitsPresenter extends BasePresenter {
205205
schedulesLimit !== null
206206
? {
207207
name: "Schedules",
208-
description: "Maximum number of schedules across all projects",
208+
description: "Maximum number of schedules per project",
209209
limit: schedulesLimit,
210210
currentUsage: scheduleCount,
211211
source: "plan",
@@ -229,7 +229,7 @@ export class LimitsPresenter extends BasePresenter {
229229
alertsLimit !== null
230230
? {
231231
name: "Alert channels",
232-
description: "Maximum number of alert channels across all projects",
232+
description: "Maximum number of alert channels per project",
233233
limit: alertsLimit,
234234
currentUsage: alertChannelCount,
235235
source: "plan",
@@ -241,7 +241,7 @@ export class LimitsPresenter extends BasePresenter {
241241
branchesLimit !== null
242242
? {
243243
name: "Preview branches",
244-
description: "Maximum number of active preview branches",
244+
description: "Maximum number of active preview branches per project",
245245
limit: branchesLimit,
246246
currentUsage: activeBranchCount,
247247
source: "plan",
@@ -297,8 +297,8 @@ export class LimitsPresenter extends BasePresenter {
297297
},
298298
features: {
299299
hasStagingEnvironment: {
300-
name: "Staging environment",
301-
description: "Access to staging environment for testing before production",
300+
name: "Staging/Preview environments",
301+
description: "Access to staging/preview environments for testing before production",
302302
enabled: hasStagingEnvironment,
303303
},
304304
support: {

apps/webapp/app/v3/services/checkSchedule.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,16 @@ export class CheckScheduleService extends BaseService {
113113
return await prisma.taskScheduleInstance.count({
114114
where: {
115115
projectId,
116+
active: true,
116117
environment: {
117118
type: {
118119
not: "DEVELOPMENT",
119120
},
121+
archivedAt: null,
122+
},
123+
taskSchedule: {
124+
active: true,
120125
},
121-
active: true,
122126
},
123127
});
124128
}

0 commit comments

Comments
 (0)