@@ -39,7 +39,6 @@ import {
3939 SCHEDULE_INFRA_RETRY_BASE_MS ,
4040 SCHEDULE_INFRA_RETRY_MAX_ATTEMPTS ,
4141 SCHEDULE_INFRA_RETRY_MAX_MS ,
42- SCHEDULE_USAGE_LIMIT_BACKOFF_MS ,
4342} from '@/lib/workflows/schedules/execution-limits'
4443import {
4544 type BlockState ,
@@ -794,20 +793,16 @@ export async function executeScheduleJob(payload: ScheduleExecutionPayload) {
794793
795794 case 402 : {
796795 /**
797- * Usage limits are a billing state, not a broken workflow, and only clear
798- * on billing-period rollover or upgrade. Back off to at most the usage-limit
799- * cadence (never faster than the schedule's own cadence) so an over-limit
800- * schedule stops re-running every tick, and count each hit toward the shared
801- * auto-disable threshold so an abandoned over-limit schedule eventually stops.
796+ * Usage limits are a billing state, not a broken workflow, but they only
797+ * clear on billing-period rollover or upgrade. Keep retrying at the normal
798+ * cadence, but count each hit toward the shared auto-disable threshold so an
799+ * abandoned over-limit schedule eventually stops instead of running forever.
802800 * A successful run resets failedCount, so transient overages self-heal.
803801 */
804- const cronNextRunAt = await calculateNextRunFromDeployment ( payload , requestId )
805- const backoffRunAt = new Date ( now . getTime ( ) + SCHEDULE_USAGE_LIMIT_BACKOFF_MS )
806802 const nextRunAt =
807- cronNextRunAt && cronNextRunAt . getTime ( ) > backoffRunAt . getTime ( )
808- ? cronNextRunAt
809- : backoffRunAt
810- logger . warn ( `[${ requestId } ] Usage limit exceeded, backing off scheduled run` , {
803+ ( await calculateNextRunFromDeployment ( payload , requestId ) ) ??
804+ new Date ( now . getTime ( ) + 60 * 60 * 1000 )
805+ logger . warn ( `[${ requestId } ] Usage limit exceeded, counting as failed run` , {
811806 scheduleId : payload . scheduleId ,
812807 nextRunAt : nextRunAt . toISOString ( ) ,
813808 } )
0 commit comments