@@ -19,6 +19,7 @@ import {
1919 type TableCleanupResult ,
2020} from '@/lib/cleanup/batch-delete'
2121import {
22+ LIVE_PAUSED_REFERENCE_STATUSES ,
2223 markLargeValuesDeleted ,
2324 pruneLargeValueMetadata ,
2425 unreferencedLargeValuePredicate ,
@@ -35,8 +36,6 @@ interface FileDeleteStats {
3536 filesDeleteFailed : number
3637}
3738
38- const RESUMABLE_PAUSED_STATUSES = [ 'paused' , 'partially_resumed' , 'cancelling' ]
39-
4039const WORKFLOW_LOG_CLEANUP_BATCH_SIZE = 500
4140const WORKFLOW_LOG_CLEANUP_MAX_BATCHES = 50
4241const WORKFLOW_LOG_CLEANUP_ROW_LIMIT =
@@ -254,7 +253,7 @@ async function cleanupLegacyLargeExecutionValues(
254253 SELECT 1
255254 FROM ${ pausedExecutions } AS ref_pe
256255 WHERE ref_pe.execution_id = ref.execution_id
257- AND ref_pe.status = ANY(${ RESUMABLE_PAUSED_STATUSES } ::text[])
256+ AND ref_pe.status = ANY(${ LIVE_PAUSED_REFERENCE_STATUSES } ::text[])
258257 )
259258 )
260259 )
@@ -277,7 +276,7 @@ async function cleanupLegacyLargeExecutionValues(
277276 SELECT 1
278277 FROM ${ pausedExecutions } AS parent_owner_pe
279278 WHERE parent_owner_pe.execution_id = parent_value.owner_execution_id
280- AND parent_owner_pe.status = ANY(${ RESUMABLE_PAUSED_STATUSES } ::text[])
279+ AND parent_owner_pe.status = ANY(${ LIVE_PAUSED_REFERENCE_STATUSES } ::text[])
281280 )
282281 OR EXISTS (
283282 SELECT 1
@@ -298,7 +297,7 @@ async function cleanupLegacyLargeExecutionValues(
298297 SELECT 1
299298 FROM ${ pausedExecutions } AS parent_ref_pe
300299 WHERE parent_ref_pe.execution_id = parent_ref.execution_id
301- AND parent_ref_pe.status = ANY(${ RESUMABLE_PAUSED_STATUSES } ::text[])
300+ AND parent_ref_pe.status = ANY(${ LIVE_PAUSED_REFERENCE_STATUSES } ::text[])
302301 )
303302 )
304303 )
@@ -314,7 +313,7 @@ async function cleanupLegacyLargeExecutionValues(
314313 SELECT 1
315314 FROM ${ pausedExecutions } AS pe
316315 WHERE pe.execution_id = split_part(${ workspaceFiles . key } , '/', 4)
317- AND pe.status = ANY(${ RESUMABLE_PAUSED_STATUSES } ::text[])
316+ AND pe.status = ANY(${ LIVE_PAUSED_REFERENCE_STATUSES } ::text[])
318317 )`
319318 )
320319 )
@@ -395,7 +394,7 @@ async function cleanupWorkflowExecutionLogs(
395394 lt ( workflowExecutionLogs . startedAt , retentionDate ) ,
396395 or (
397396 isNull ( pausedExecutions . status ) ,
398- notInArray ( pausedExecutions . status , RESUMABLE_PAUSED_STATUSES )
397+ notInArray ( pausedExecutions . status , [ ... LIVE_PAUSED_REFERENCE_STATUSES ] )
399398 )
400399 )
401400 )
0 commit comments