feat(limits): better limits messages and some more fixes

This commit is contained in:
Gergő Jedlicska
2025-04-18 15:58:28 +02:00
parent f2c778a3c0
commit 2d26c76ef2
4 changed files with 22 additions and 8 deletions
@@ -23,9 +23,9 @@ const { commentLimitFormatted, versionLimitFormatted } = useWorkspaceLimits(
const text = computed(() => {
if (props.limitType === 'comment') {
return `Upgrade to view comments older than ${commentLimitFormatted.value}.`
return `Upgrade your plan to view comments older than ${commentLimitFormatted.value}.`
}
return `Upgrade to view versions older than ${versionLimitFormatted.value}.`
return `Upgrade your plan to view versions older than ${versionLimitFormatted.value}.`
})
const actions = computed((): AlertAction[] => [
@@ -24,19 +24,19 @@ export const scheduledCallbackWrapper = async (
// if couldn't acquire it, stop execution
if (!lock) {
boundLogger.warn('Could not acquire task lock for {taskName}, stopping execution.')
boundLogger.info('Could not acquire task lock for {taskName}, stopping execution.')
return
}
try {
// else continue executing the callback...
boundLogger.info(
boundLogger.debug(
{ scheduledTime },
'Executing scheduled function {taskName} at {scheduledTime}'
)
await callback(scheduledTime, { logger: boundLogger })
// update lock as succeeded
const finishDate = new Date()
boundLogger.info(
boundLogger.debug(
{ durationSeconds: (finishDate.getTime() - scheduledTime.getTime()) / 1000 },
'Finished scheduled function {taskName} execution succeeded in {durationSeconds} seconds'
)
+1 -1
View File
@@ -114,7 +114,7 @@ const scheduleWorkspaceSubscriptionDownscale = ({
const scheduleWorkspacePlanMigrations = (scheduleExecution: ScheduleExecution) => {
let isMigrationComplete = false
let isMigrationRunning = false
const cronExpression = '*/5 * * * * *' // every 5 seconds
const cronExpression = '*/1 * * * *' // every minute
return scheduleExecution(
cronExpression,
'WorkspaceNewPlanMigration',
@@ -204,7 +204,13 @@ export const ensureWorkspaceProjectCanBeCreatedFragment: AuthPolicyEnsureFragmen
return currentProjectCount < workspaceLimits.projectCount
? ok()
: err(new WorkspaceLimitsReachedError({ payload: { limit: 'projectCount' } }))
: err(
new WorkspaceLimitsReachedError({
message:
'You have reached the maximum number of projects for your plan. Upgrade to increase it.',
payload: { limit: 'projectCount' }
})
)
}
/**
@@ -263,5 +269,13 @@ export const ensureModelCanBeCreatedFragment: AuthPolicyEnsureFragment<
return currentModelCount < workspaceLimits.modelCount
? ok()
: err(new WorkspaceLimitsReachedError({ payload: { limit: 'modelCount' } }))
: err(
new WorkspaceLimitsReachedError({
message:
'You have reached the maximum number of models for your plan. Upgrade to increase it.',
payload: {
limit: 'modelCount'
}
})
)
}