()
| 307 | if (isTriggerAvailable()) { |
| 308 | let batch: CleanupJobPayload[] = [] |
| 309 | const flushBatch = async () => { |
| 310 | if (batch.length === 0) return |
| 311 | const currentBatch = batch |
| 312 | batch = [] |
| 313 | const region = await resolveTriggerRegion() |
| 314 | const batchResult = await tasks.batchTrigger( |
| 315 | jobType, |
| 316 | currentBatch.map((payload) => ({ |
| 317 | payload, |
| 318 | options: { |
| 319 | tags: [`plan:${payload.plan}`, `jobType:${jobType}`], |
| 320 | concurrencyKey: getCleanupConcurrencyKey(jobType), |
| 321 | region, |
| 322 | }, |
| 323 | })) |
| 324 | ) |
| 325 | jobIds.push(batchResult.batchId) |
| 326 | succeeded += currentBatch.length |
| 327 | } |
| 328 | |
| 329 | const { chunkCount, workspaceCount } = await forEachCleanupChunk(jobType, async (payload) => { |
| 330 | batch.push(payload) |
no test coverage detected